Authentication and environments
Related
Every product and customer call goes to one of two hosts and carries an access token for the seller.
Hosts
| Environment | Base URL |
|---|---|
| Sandbox (testing) | https://payme-store-staging.payme.io/api/ |
| Production | https://payme-store.payme.io/api/ |
These hosts are separate from the Payments API hosts (sandbox.payme.io, live.payme.io). Use sandbox credentials (the seller's sandbox MPL and your sandbox payme_client_key) with the sandbox host, and production credentials with the production host.
Authentication
- Call
POST /auth-tokenswith{"mpl": "<seller MPL>", "key": "<partner payme_client_key>"}. The seller must belong to the partner whose key you send. The call returns HTTP201withauth_token(a JWT) andrefresh_token. - Send
Authorization: Bearer <auth_token>on every product and customer call. A missing, invalid or expired token returns HTTP401. - When the access token expires, call
POST /refresh-exchangeswith{"refresh_token": "<refresh_token>"}. No headers are needed. It returns a newauth_tokenand a newrefresh_token. Each refresh token works once, so store the new one. If the refresh token has expired or was already used, start again at step 1.
Only partners can get a token: key is the partner's payme_client_key, and a seller without a partner key can't call this API. What the MPL (seller_payme_id) and the partner key are: Payments Authentication and environments.