Payments
Confirm Payment
Confirm order with 0 amount (with coupon discount)
Set cookie: session_id value what we got from authenticate
POST /api/v1/store/order/confirm-payment
{ "Content-Type": "application/json", "Cookie": "session_id=4e21fd7bf236b7d283b471254b8c94a57c8a3a08"}Request Body:
{ "order_id": 30}Response:
{ "result": true}Providers
Return list of available payments and payment methods
Set cookie: session_id value what we got from authenticate
POST /api/v1/store/payment/providers
{ "Content-Type": "application/json", "Cookie": "session_id=4e21fd7bf236b7d283b471254b8c94a57c8a3a08"}Request Body:
{}Response:
[ { "id": 10, "name": "PayPal", "paymentName": "PayPal", "payment_methods": [ { "id": 103, "name": "Paypal" } ] }]Create Payment Transaction
Create payment transaction, start payment by payment provider
Set cookie: session_id value what we got from authenticate
POST /api/v1/store/payment/transaction/10
Headers:
{ "Content-Type": "application/json", "Cookie": "session_id=4e21fd7bf236b7d283b471254b8c94a57c8a3a08"}10 in URL - payment provider ID (get this from previous request of provider details)
“payment_method_id” - id of the payment method (get this from previous request of provider details)
“return_url” - where to return after payment
Request Body:
{ "order_id": "14", "payment_method_id": "103", "return_url": "", "cancel_url": ""}Response:
{ "provider_id": 10, "provider_code": "paypal", "reference": "TGO13-2400014", "amount": 2.0, "currency_id": 125, "partner_id": 14, "redirect_form_html": "\n <form method=\"post\" action=\"https://www.sandbox.paypal.com/cgi-bin/webscr\">\n <input type=\"hidden\" name=\"address1\" value=\"street 123\"/>\n <input type=\"hidden\" name=\"amount\" value=\"2.0\"/>\n <input type=\"hidden\" name=\"business\" value=\"maxcrc-merchant@maxcrc.de\"/>\n <input type=\"hidden\" name=\"cancel_return\" value=\"http://localhost:8017/payment/paypal/cancel/?tx_ref=TGO13-2400014&access_token=8b2a6ba9ceb9e1288b6c74b576167f54a18e480c1535b39de5b9ebf29e1dce8b\"/>\n <input type=\"hidden\" name=\"city\" value=\"CityName\"/>\n <input type=\"hidden\" name=\"cmd\" value=\"_xclick\"/>\n <input type=\"hidden\" name=\"country\" value=\"DJ\"/>\n <input type=\"hidden\" name=\"currency_code\" value=\"EUR\"/>\n <input type=\"hidden\" name=\"email\" value=\"test3@example.com\"/>\n <input type=\"hidden\" name=\"first_name\" value=\"Test2\"/>\n <input type=\"hidden\" name=\"item_name\" value=\"CTT: TGO13-2400014\"/>\n <input type=\"hidden\" name=\"item_number\" value=\"TGO13-2400014\"/>\n <input type=\"hidden\" name=\"last_name\" value=\"Test2\"/>\n <input type=\"hidden\" name=\"notify_url\" value=\"http://localhost:8017/payment/paypal/webhook/\"/>\n <input type=\"hidden\" name=\"return\" value=\"http://localhost:8017/payment/paypal/return/\"/>\n <input type=\"hidden\" name=\"rm\" value=\"2\"/>\n <input type=\"hidden\" name=\"zip\" value=\"1234\"/>\n </form>"}Get Payment Transaction
Get payment transaction (created by Create Payment Transaction method)
Set cookie: session_id value what we got from authenticate
POST /api/v1/models/payment_transaction
Headers:
{ "Content-Type": "application/json", "Cookie": "session_id=4e21fd7bf236b7d283b471254b8c94a57c8a3a08"}TGE100-2506003-3 in domain - payment transaction reference (“reference” field received from create transaction request)
In most cases this can be done to get transaction “state” field
Available states is “draft”, “pending”, “authorized”, “done”, “cancel”, “error”
Paid transaction has status “done”
Request Body:
{ "fields": [ "id", "name", "reference" ], "offset": 0, "domain": [ ["reference", "=", "TGE100-2506003-3"] ]}Response:
[ { "id": 5111, "reference": "TGE100-2506003-3", "state": "done" }]