|
4 | 4 | * How to create a first payment to allow recurring payments later. |
5 | 5 | */ |
6 | 6 |
|
7 | | -use Mollie\Api\Factories\CreatePaymentRequestFactory; |
8 | 7 | use Mollie\Api\Http\Data\Metadata; |
9 | 8 | use Mollie\Api\Http\Data\Money; |
10 | 9 | use Mollie\Api\Http\Requests\CreateCustomerPaymentRequest; |
11 | 10 | use Mollie\Api\Http\Requests\GetPaginatedCustomerRequest; |
12 | | -use Mollie\Api\Types\SequenceType; |
13 | 11 |
|
14 | 12 | try { |
15 | 13 | /* |
|
40 | 38 | * |
41 | 39 | * @See: https://docs.mollie.com/reference/v2/customers-api/create-customer-payment |
42 | 40 | */ |
43 | | - $payload = CreatePaymentRequestFactory::new([ |
44 | | - 'description' => "First payment - Order #{$orderId}", |
45 | | - 'amount' => new Money('EUR', '10.00'), |
46 | | - 'redirectUrl' => "{$protocol}://{$hostname}/payments/return.php?order_id={$orderId}", |
47 | | - 'webhookUrl' => "{$protocol}://{$hostname}/payments/webhook.php", |
48 | | - 'metadata' => new Metadata([ |
49 | | - 'order_id' => $orderId, |
50 | | - ]), |
51 | | - 'sequenceType' => SequenceType::FIRST, |
52 | | - ])->create(); |
53 | | - |
54 | 41 | $payment = $mollie->send( |
55 | | - new CreateCustomerPaymentRequest($customer->id, $payload) |
| 42 | + new CreateCustomerPaymentRequest( |
| 43 | + $customer->id, |
| 44 | + "First payment - Order #{$orderId}", |
| 45 | + new Money('EUR', '10.00'), |
| 46 | + "{$protocol}://{$hostname}/payments/return.php?order_id={$orderId}", |
| 47 | + "{$protocol}://{$hostname}/payments/webhook.php", |
| 48 | + new Metadata([ |
| 49 | + 'order_id' => $orderId, |
| 50 | + ]) |
| 51 | + ) |
56 | 52 | ); |
57 | 53 |
|
58 | 54 | /* |
|
0 commit comments