Update Subscriptions.php

This commit is contained in:
2022-09-29 16:00:34 +02:00
committed by GitHub
parent a205365bf5
commit e4378d67c1

View File

@@ -10,7 +10,7 @@ class Subscriptions
{ {
// //
} }
/** /**
* Get subscriptions from user. * Get subscriptions from user.
* *
@@ -37,21 +37,11 @@ class Subscriptions
* name, description, period, price * name, description, period, price
* and following attributes are optional: * and following attributes are optional:
* vat, payload, ends_at, webhook_url, webhook_secret * vat, payload, ends_at, webhook_url, webhook_secret
* @param array $payload optional data that is stored in the subscription
* @param bool $checkout optional checkout it directly
* @return object|false the subscription object * @return object|false the subscription object
* @throws GuzzleException * @throws GuzzleException
*/ */
public function create(string $name, array $attributes, array $payload = [], bool $checkout = false): object|false public function create(array $attributes): object|false
{ {
$defaults = ['period' => 'monthly'];
$attributes = array_merge(array_merge($defaults, $attributes), [
'payload' => array_merge($payload, [
'name' => $name,
]),
'checkout' => $checkout
]);
return $this->user->asPaymentsUser('POST', 'subscriptions', $attributes)->data; return $this->user->asPaymentsUser('POST', 'subscriptions', $attributes)->data;
} }