API calls and Payment flows
To better understand the API functionality and the API calls, please refer to the calls diagram below:
API calls
sequenceDiagram
actor Customer
autonumber
note over Customer: Checkout process
Customer->>Eshop: purchase goods
activate Eshop
Eshop->>Merchant's Server: create checkout
deactivate Eshop
activate Merchant's Server
Merchant's Server->>Twisto: CheckoutCreate (POST)
activate Twisto
Twisto->>Merchant's Server: CheckoutCreate response
deactivate Twisto
Merchant's Server->> Customer: redirect to Twisto Gateway
deactivate Merchant's Server
activate Customer
Customer ->> Twisto: redirected Twisto Gateway webpage
deactivate Customer
activate Twisto
Twisto ->> Twisto: risk evaluation
Twisto ->> Merchant's Server: redirect to checkout.redirect_uri
deactivate Twisto
opt asynchronous noticiations enabled
note over Customer: Checkout <br/>status update
Twisto ->> Merchant's Server: webhook (checkout.status)
end
opt immediate capture not enabled
note over Customer: Charge
Merchant's Server ->> Twisto: ChargeCreate (POST)
activate Merchant's Server
activate Twisto
Twisto ->> Merchant's Server: ChargeCreate response
deactivate Twisto
deactivate Merchant's Server
end
opt refund
note over Customer: Refund
Customer ->> Eshop: returns goods
activate Eshop
Eshop ->> Merchant's Server: reports a return
deactivate Eshop
activate Merchant's Server
Merchant's Server ->> Twisto: RefundCreate (POST)
activate Twisto
Twisto ->> Merchant's Server: RefundCreate response
deactivate Twisto
deactivate Merchant's Server
end
Payment status flows
Checkouts status flow
The first API call you will make in processing a Twisto payment is a call to our /checkouts
endpoint. This request is made once a customer chooses Twisto as their payment method for a transaction.
Charges status flow
Deos not apply if you selected
Immediate Capture
mode during your PSP platform registration.
The API call you will make to complete a Twisto payment is a call to our /charges
endpoint.
This request is made once you have received an Approved checkout result back from Twisto. (via a webhook or in the redirect URL to your eshop)
If checkout is not approved, /charges
will be rejected