Web – Paymee Integration

Step 1 – Initiate payment

In this step we will initiate a payment.

Sandbox URL: https://sandbox.paymee.tn/api/v1/payments/create
Live URL: https://app.paymee.tn/api/v1/payments/create
Request method: POST

Header

Input

{
    "vendor": 5020,
    "amount": 120.5,
    "note" : "Order #1000132"
}

Output

The token is the identifier of the payment. We will use it in the next step.

{
    "status": true,
    "message": "Success",
    "code": 50,
    "data": {
        "token": "5d41404b2a76b9719c592e6f84b68d92",
        "amount": 10.0
    }
}

Step 2 – Redirect the user

In this step we will build the form that redirects to the Paymee gateway.

Le module en Sandbox affiche le paiement par compte Paymee, seulement, pour effectuer les tests. Le paiement par carte bancaire sera activé en Production.

Buyer test account :
Phone: 11111111
Password: 11111111

Sandbox URL: https://sandbox.paymee.tn/gateway/
Live URL: https://app.paymee.tn/gateway/
Request method: POST

Input

<form method="post" action="https://sandbox.paymee.tn/gateway/">
  <input type="hidden" name="payment_token" value="5d41404b2a76b9719c592e6f84b68d92">
  <input type="hidden" name="url_ok" value="https://example.com/ok.php">
  <input type="hidden" name="url_ko" value="https://example.com/ko.php">
  <button>Payer</button>
</form>

As you can see, three parameters are sent through the form:

payment_token: The token received in Step 1
url_ok: The page to go to when payment is done
url_ko: The page to go to when the user cancels the payment. It can be the same as url_ok but with a different processing on the merchant site

When payment is done, two parameters are appended to the url_ok: eg. https://example.com/ok.php?payment_token=5d41404b2a76b9719c592&transaction=12345

payment_token: The token used in the payment. It should be the same received in step 1, otherwise the payment fails.
transaction: The transaction identifier in Paymee’s system

Step 3 – Check payment

In this step we will check if the payment was really done.

Sandbox URL: https://sandbox.paymee.tn/api/v1/payments/{token}/check
Live URL: https://app.paymee.tn/api/v1/payments/{token}/check
Request method: GET

Header

Input

Output

If the buyer uses the wallet to pay, the buyer_id will be filled. Otherwise buyer_id is 0.

{
    "status": true,
    "message": "Success",
    "code": 50,
    "data": {
        "payment_status": true,
        "token": "5d41404b2a76b9719c592e6f84b68d92",
        "amount": 3.0,
        "transaction_id": 126627,
        "buyer_id": 10253
    }
}

Downloadable assets