Wiki source code of Callbacks
Last modified by Asbjørn Ulsberg on 2018/07/05 12:48
1 | PayEx emits callbacks on all events happening to a payment asynchronously. These callbacks can be used to update the implementers backend systems, send receipts, or any other task related to a change in a payment's status. |
2 | |
3 | Events like |
4 | |
5 | * Cancel |
6 | * Capture |
7 | * Reversal |
8 | * Authorize |
9 | |
10 | = Implementation details = |
11 | |
12 | The implementer registers the callback-url when posting the payment session. The URL should be unique per payment. The resource contains 4 properties: |
13 | |
14 | |(% style="text-align:right" %)**Property** |= Description |
15 | |(% style="text-align:right" %){{code}}payment{{/code}}|The URL of the affected Payment. Perform a GET request on it to retrieve the Payment status. |
16 | |(% style="text-align:right" %){{code}}paymentNumber{{/code}}|The human identifiable number of the Payment, used when talking or writing about the Payment. Only the URL should be used to programmatically identify the Payment. |
17 | |(% style="text-align:right" %){{code}}transactiond{{/code}}|The URL of the affected transaction. Perform a GET request on it to retrieve information about the Transaction. |
18 | |(% style="text-align:right" %){{code}}transactionNumber{{/code}}|The human identifiable number of the Transaction, used when talking or writing about the Transaction. Only the URL should be used to programmatically identify the Transaction. |
19 | |
20 | A Credit Card Callback looks like this: |
21 | |
22 | {{code language="JavaScript"}} |
23 | POST scheme://your.defined.host/and-path/for-recieving HTTP/1.1 |
24 | Content-Type: application/json |
25 | |
26 | { |
27 | "payment": "/psp/creditcard/payments/<paymentId>", |
28 | "paymentNumber": 123456, |
29 | "transaction": "/psp/creditcard/payments/<paymentId>/transactions/<transactionId>", |
30 | "transactionNumber": 12345678 |
31 | } |
32 | |
33 | {{/code}} |
34 | |
35 | >**Note!** It is highly probable that this part of the documentation will get changes in the near future. |