Create a payout
Send money to your customers.
Overview
You can use payout to send money to your customer without any reference to previous transactions. Possible use cases for this transaction could be paying out sellers on your marketplace, online gaming, or lottery wins.
The payout transaction is currently available for the following payment types:
- Card
- Unzer Direct Debit secured
Payout triggers a payment transaction from the merchant to the customer.
Example
A payout is triggered by calling the /payments/payouts
after you have created your preferred payment type with an amount, a currency, transactions’ description and a reference to a payment type.
Request
$unzer = new UnzerSDK\Unzer('s-priv-xxxxxxxxxx');
$card = $unzer->fetchPaymentType('s-crd-9wmri5mdlqps');
$payout = $unzer->payout(100.00, 'EUR', $card, 'https://your.return.url');
$unzer = new UnzerSDK\Unzer('s-priv-xxxxxxxxxx');
$card = $unzer->fetchPaymentType('s-crd-9wmri5mdlqps');
$payout = $card->payout(100.0, 'EUR', 'https://your.return.url', null, null, null, null, 'invoiceId', 'payment reference text');
Arguments to PaymentType::payout
Name | Type | Description |
---|---|---|
amount | float | The amount to credit the given payment type with. Required: true |
currency | string | The currency of the amount. Required: true |
returnUrl | string | A return URL (which is not used in this transaction). |
customer | string or UnzerSDK\Resources\Customer | A reference to the customer resource corresponding to this transaction. This can be either a customer object or the ID of an existing customer resource. If a customer object is used whose ID is not set (i. e. the resource does not exist yet in the Unzer API) the customer resource will automatically be created and referenced with the transaction call. For more details, see Manage customer. Required: only in case of guaranteed payment types Default: null |
orderId | string | The ID of the order in your store. Required: false Default: null |
metadata | UnzerSDK\Resources\Metadata | A reference to the metadata corresponding to this payment. The metadata object can be used to pass along custom information which you whish to reference to the payment. For more details, see Manage metadata Required: false Default: null |
basket | UnzerSDK\Resources\Basket | A reference to the basket corresponding to this payment. For more details, see Manage baskets. Required: false Default: null |
invoiceId | string | This is used to transmit the invoice ID from your shop to the API. Required: false Default: null |
paymentReference | string | The reference string is show to the customer as reference text on their bank statement. Required: false Default: null |
Response
A payout
call returns a payment ID and the payout ID 1, because only one payout per payment is possible.
The parameters isSuccess
, isPending
, isError
indicate the result of the transaction. Only one of these three can be true.
Returned amounts
When fetching the payout
resource (s-out-…), transaction value will be positive, for example 100. But when fetching the payment
resource (of which payout
is part of), transaction value will be negative (-100).
$amount = $payment->getAmount()->getTotal // is-100