Successful payment

Now that you have set up the necessary structure and security measures to ensure that any event you process is from Yoco, you can proceed to handle the successful payment event.

You can verify the payment status by checking the type field of the webhook event. A payment is considered successful if its type is set to payment.succeeded.

Event structure

ParameterTypeDescription
id
string
The unique identifier for the event.
type
string
The type of event, one of payment.succeeded, refund.succeeded or refund.failed.
payload
object
The payload consists of additional information related to the event, for example, the Payment or Refund object.

Sample event

{
"id": "evt_1EAwK8Mjy2DT38WIWntiZWxm",
"type": "payment.succeeded",
"createdDate": "2023-06-15T15:51:55.260284Z",
"payload": {
"id": "p_bx4bY9JA6r4UwAKFyAjHY2bE",
"type": "payment",
"createdDate": "2023-06-15T17:51:54.405141Z",
"amount": 900,
"currency": "ZAR",
"paymentMethodDetails": {
"type": "card",
"card": {
"expiryMonth": 2,
"expiryYear": 30,
"maskedCard": "************1111",
"scheme": "visa"
}
},
"status": "succeeded",
"mode": "live",
"metadata": {
"checkoutId": "ch_9LVKD8GnAj7f39DFbn4F16bE"
}
}
}