Integration
Four steps to the first payment
This is the whole hosted-page integration. Everything else is detail on top of it.
The base address of the sandbox and of the live gateway is issued together with your keys. The examples below use $MP_API_BASE for it.
- 01Get sandbox keys
Send the application and we issue test keys, the base address and the specification with field names and error codes. Nothing is charged in the sandbox.
- 02Create a payment
One request. In the response you get the payment identifier and the link to the payment page.
curl -X POST "$MP_API_BASE/payments" \ -H "Authorization: Bearer $MP_KEY" \ -H "Content-Type: application/json" \ -d '{ "amount": "40.00", "currency": "GEL", "orderId": "shop-4412", "description": "1 Day Membership, Coffee", "callbackUrl": "https://shop.example/payments/callback", "returnUrl": "https://shop.example/orders/4412" }' - 03Send the customer to the page
Redirect to the link from the response. The customer pays and comes back to your returnUrl. Do not treat the return as proof of payment: it only means the browser came back.
{ "id": "pay_8f2b41c7", "status": "created", "paymentUrl": "https://pay.multiprime.ge/i/8f2b41c7" } - 04Accept the callback and confirm the status
The status arrives at your callbackUrl. Verify the signature, then read the payment once more and only then release the goods. A callback can arrive twice, so the handler has to be idempotent.
curl "$MP_API_BASE/payments/pay_8f2b41c7" \ -H "Authorization: Bearer $MP_KEY"