Skip to content

POST Payment Process

https://api.magmaonepay.com/v1/payment/process



Process Payment

This guide helps you to understand how to process a payment that has already been initialized using the API.

Response Information

Upon processing the payment, the API will return the following information:

Response ParameterTypeDescription
codeintegerThe HTTP status code returned by the API
messagestringA message indicating the result of the API operation
dataobjectAn object containing the payment processing details
data.payment_tokenstringA unique identifier for the payment transaction
data.created_atstringThe timestamp when the payment was created
data.updated_atstringThe timestamp when the payment was last updated
data.success_atstringThe timestamp when the payment was successfully processed
data.merchant_transaction_idstringThe unique ID for the transaction provided by the merchant
data.amountstringThe amount of the payment
data.currencystringThe currency of the payment
data.descriptionstringA description of the payment
data.payeestringThe payee's mobile number
data.payee_first_namestringThe payee's first name
data.payee_last_namestringThe payee's last name
data.payment_methodstringThe payment method used for the transaction
data.payment_processing_referencestringA reference for the payment processing
data.custom_fieldstringA custom field for additional information
data.payment_statusstringThe current status of the payment
data.payment_status_codestringThe code representing the payment status
data.payment_status_messagestringThe message describing the payment status
data.metaobjectAdditional metadata related to the payment transaction
data.meta.otpbooleanIndicates whether the payment requires an OTP code
data.meta.otp_lengthintegerThe length of the OTP code required
data.meta.redirect_customer_to_url_processingbooleanIndicates whether the customer should be redirected to a URL for processing
data.meta.before_payment_instructionsstringInstructions before the payment
data.meta.after_payment_instructionsstringInstructions after the payment

This response information can be used by the merchant to update the transaction's status on their end, provide a receipt to the customer, or handle any next steps required based on the payment's status.

HEADERS

AuthorizationBearer TOKEN

NB: TOKEN is your private secret key dependant on your mode (live or test) for server-side

Body

raw (json)
json

{
    "payment_token": "payment_token",
    "otp_code": "1234" // Required if payment_method has otp true
}

Example Request

curl
curl --location 'https://api.magmaonepay.com/v1/payment/process' \
--header 'Authorization: Bearer TOKEN' \
--data '{
    "payment_token": "91ce0608-16b3-4bf4-a2d8-1ab46e776cc2",
    "otp_code": "1234"
}'

Example Response ([Pending])

Body
json
{
    "code": 200,
    "message": "OK",
    "data": {
        "payment_token": "73351d2a-c2bd-4d7c-8f1a-35ddbe9bd606",
        "created_at": "2024-06-04 00:12:55",
        "updated_at": "2024-06-04 00:35:18",
        "success_at": null,
        "merchant_transaction_id": "97e1ab54-871-11ee-b9d1-0242ac12000s3ss",
        "amount": "10000",
        "currency": "XOF",
        "description": "Payment description",
        "payee": "+2250759423253",
        "payee_first_name": "john",
        "payee_last_name": "doe",
        "payment_method": "ORANGE_CI",
        "payment_processing_reference": null,
        "custom_field": "any_string",
        "payment_status": "pending",
        "payment_status_code": "103",
        "payment_status_message": "WAITING_CUSTOMER_CONFIRMATION",
        "meta": {
            "otp": false,
            "otp_length": 0,
            "redirect_customer_to_url_processing": false,
            "before_payment_instructions": "Make sure you have enough balance.",
            "after_payment_instructions": "Check your account for the transaction details."
        }
    }
}
Headers (1)

Content-Type        application/json