Payment API¶
To get payments and manage them, use the Ibexa\Contracts\Payment\PaymentServiceInterface interface.
By default, UUID is used to generate payment identifiers.
You can change that by providing a custom payment identifier in Ibexa\Contracts\Payment\Payment\PaymentCreateStruct or Ibexa\Contracts\Payment\Payment\PaymentUpdateStruct.
Get single payment¶
Get single payment by ID¶
To access a single payment by using its numerical ID, use the PaymentServiceInterface::getPayment method:
1 2 3 4 | |
Get single payment by identifier¶
To access a single payment by using its string identifier, use the PaymentServiceInterface::getPaymentByIdentifier method:
1 2 | |
Get multiple payments¶
To fetch multiple payments, use the PaymentServiceInterface::findPayments method.
It follows the same search query pattern as other APIs:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
Create payment¶
To create a payment, use the PaymentServiceInterface::createPayment method and provide it with the Ibexa\Contracts\Payment\Payment\PaymentCreateStruct object that takes the following arguments: method, order and amount.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
Update payment¶
You can update payment information after the payment is created.
You could do it to support a scenario when, for example, an online payment failed, has been processed by using other means, and its status has to be updated in the system.
The Ibexa\Contracts\Payment\Payment\PaymentUpdateStruct object takes the following arguments: transition, identifier, and context.
To update payment information, use the PaymentServiceInterface::updatePayment method:
1 2 3 4 5 6 | |
Delete payment¶
To delete a payment from the system, use the PaymentServiceInterface::deletePayment method:
1 | |