Skip to main content

Faire une transaction

ENDPOINT

https://api.adjeminpay.net/v2/transactions

REQUÊTE POST HTTP

PARAMETRES

  • merchant_transaction_id : la rĂ©fĂ©rence unique de la transaction fournit par le marchand (vous)
  • designation : le motif de la transaction
  • currency_code : la dĂ©vise doit ĂȘtre XOF
  • buyer_name : le nom de l'utilisateur
  • buyer_reference : le numĂ©ro de tĂ©lĂ©phone ou la rĂ©fĂ©rence fourni par l'utilisateur qui fait le paiement exemple 2250500000000
  • otp : utilisĂ© lorsque le moyen de paiement est Orange Money: le code de 4 chiffres gĂ©nĂ©rer par l'utilisateur Pour obtenir votre code d'autorisation Orange Money, merci de taper #144#, choisir l'option 8 puis l'option 2. Puis entrez votre code secret et validez.
  • amount : le montant de la transaction
  • payment_method_reference : le moyen de paiement utilisĂ© ORANGE_CI ou MTN_CI
  • notification_url: Votre url de notification pour le webhook que fera AdjeminPay Ă  la fin de la transaction

HEADER

  • Accept doit avoir comme valeur application/json
  • Content-Type doit avoir comme valeur application/x-www-form-urlencoded
  • Authorization doit avoir comme valeur Bearer TOKEN
CurlAPI
curl --location --request POST 'https://api.adjeminpay.net/v2/transactions' \
--header 'Accept: application/json' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Bearer TOKEN' \
--data-urlencode 'merchant_transaction_id=c61e2d55-3cee-4874-850e-aab3f9c9ff9b' \
--data-urlencode 'designation=Test' \
--data-urlencode 'currency_code=XOF' \
--data-urlencode 'buyer_name=Ange Bagui' \
--data-urlencode 'otp=5332' \
--data-urlencode 'notification_url=https://adjemin.com' \
--data-urlencode 'payment_method_reference=ORANGE_CI' \
--data-urlencode 'buyer_reference=2250748346813' \
--data-urlencode 'amount=10000'
OBLIGATOIRE

N'oubliez pas de les remplacer par leurs valeurs.

RÉPONSE ATTENDUE

HTTP Status Code 200

{
"code": 2002,
"status": "PENDING",
"message": "User have started payment",
"data": {
"id": 33377,
"merchant_id": 203,
"user_id": 206,
"application_id": 87,
"currency_code": "XOF",
"amount": 10,
"type": 0,
"payment_method_id": 2,
"is_waiting": true,
"is_canceled": false,
"card_provider_id": null,
"is_approuved": null,
"canceled_at": null,
"approuved_at": null,
"status": "PENDING",
"deleted_at": null,
"created_at": "2021-06-13T16:13:16.000000Z",
"updated_at": "2021-06-13T16:13:22.000000Z",
"reference": "61b6d296-d0e5-498b-b01f-c9497160e17d",
"designation": "Test",
"client_reference": "03f404d9-b794-48f3-97c4-a390f160eb1b",
"reason": null,
"notif_url": "https://adjemin.com",
"error_meta_data": null,
"buyer_reference": "2250556888385",
"provider_payment_id": null,
"orange_payment_url": "https://proxy.momoapi.mtn.com/collection/v1_0/requesttopay/61b6d296-d0e5-498b-b01f-c9497160e17d",
"orange_pay_token": null,
"buyer_name": "Ange Bagui",
"payment_method_code": "MTN_CI",
"phone_number": "2250556888385",
"is_initiated": false,
"is_completed": false,
"return_url": null,
"cancel_url": null
}
}

REPONSE D'ERREUR

HTTP Status Code 400, 401, 404, 500

{
"code": 2010,
"status": "FAILED",
"message": "Payment has failed",
"data": {
"application_id": 87,
"reference": "01c495b1-3a5d-42c8-890c-89ef2c7f7013",
"is_initiated": false,
"status": "FAILED",
"merchant_id": 203,
"user_id": 206,
"amount": 10000,
"designation": "Test",
"currency_code": "XOF",
"client_reference": "6b0bb1c2-d9c1-4379-a4cb-d350b9db1a80",
"payment_method_id": 2,
"payment_method_code": "MTN_CI",
"type": 0,
"buyer_reference": "2250556888385",
"buyer_name": "Ange Bagui",
"phone_number": "2250556888385",
"notif_url": "https://adjemin.com",
"is_waiting": false,
"is_completed": true,
"updated_at": "2021-06-15T16:15:53.000000Z",
"created_at": "2021-06-15T16:15:49.000000Z",
"id": 33425,
"reason": "User has not enough balance to validate operation"
}
}

STATUS CODES#

CODESTATUSMESSAGE
200OKSuccessful operation
100SUCCESSTransaction is successfully processed
-1OPERATION_ERRORAn error has occurred
404NOT_FOUNDNot found
400BAD_REQUESTYour request is missing some headers or parameters
1005INVALID_CREDENTIALSThe requested service needs credentials, but the ones provided were invalid.
1002INVALID_PARAMSParams you provides are invalid
1003EXPIRED_TOKENToken has expired
1004INVALID_TOKENToken is invalid
1200TRANSACTION_EXISTThe transaction already exists
2001INITIATEDWaiting for user entry
2002PENDINGUser have started payment
2003EXPIREDUser has not confirmed the payment
2004OTP_ERROROtp user provided is incorrect
2008OTP_EXPIREDOtp user provided has expired
2005INSUFFICIENT_BALANCEUser has not enough balance to validate operation
2006USER_NOT_FOUNDUser does not exist
2007USER_IS_BLOCKEDUser has been blocked
2010FAILEDPayment has failed
2011NOT_ALLOWEDThis Ip is not whitelisted
2012CANCELLEDUser have cancelled payment
2013UNIMPLEMENTEDUnimplemented operation

Capture the payment notification in your backend#

Do you remember the parameter notification_url YOUR NOTIFICATION URL ?

You must now implement it in your backend to be notified of the progress of the payment and update your database.

When you initiate a transaction you provide a notification_url to which we notify you of the outcome of the transaction to allow you to have the details of the transaction.

AdjeminPay makes an HTTP request to your notification_url with the POST method and the following parameters in BODY:

The Content-Type of the request is application/x-www-form-urlencoded

  • transaction_id : the transaction reference provided by the merchant (you)
  • status : the payment status
  • amount : the amount of the transaction
  • phone_number : the phone number provided by the user making the payment
  • buyer_name : user's name
  • buyer_reference :the phone number or reference provided by the user making the payment
  • currency_code : currency
  • cancelled_at : if the transaction is canceled, the date on which the transaction is canceled
  • approuved_at : if the transaction is approved, the date the transaction is approved
  • transaction_type : the payment method used ORANGE_CI or MTN_CI