Refund

Use to refund a payment transaction (status =5)

  • Partial refund:
    • Refund part of the transaction amount (when the amount to be refunded is less than the paid amount).
    • For international card transactions, partial refunds can only be processed 24 hours after the original transaction is successfully completed.
       
  • Full refund: Refund all of the transaction amount (when the amount to be refunded is equal to the paid amount).

 

A. Process flow

 

B. API configuration

The header will be built according to the Integration Rules for the APIs 

 

1. Create refund request

POST /v2/refunds/create

 

Request

Attribute Type Required Description
request_id String (30) yes Request ID, unique for each request
payment_no Number yes 9Pay's transaction id
amount Number yes

Amount to be refunded

description String (255) yes Desctiption of refund request
bank String no Bank codes list. Required if the transaction is a bank transfer
account_number String (20) no Bank account name.  Required if the transaction is a bank transfer
customer_name String (32) no Account holder's name .  Required if the transaction is a bank transfer

 

Example request:

{

    "request_id" : "RF_56462",

    "order_code" : "42580311462342",

    "amount": 530300,

    "description": "Hoàn gd 42086663133111",

    "bank":"VCB",

    "account_number":"123456789",

    "customer_name":"nguyen van a"

}

 

Reponse

Attribute Type Required Description
status Number Transaction status
error_code String Error code
failure_reason String không

Error description

amount Number Refunded Amount
order_code Number 9Pay's transaction ID
refund_no Number không 9Pay's refund transaction ID
request_id String Unique ID of each request

 

Example reponse:

{

    "request_id": "RF_56462",

    "refund_no": 42583024695127,

    "status": 2,

    "error_code": "999",

    "failure_reason": "Processing ",

    "amount": 74678,

    "order_code": 42580080605009

}

 

 

2. Processing refund result

Merchants will receive the result for refund requests via
IPN: data is POSTed (x-www-form-data) to the merchant's registered ipn_refund_url address with 9Pay. Partners use this result to handle backend business processes

Data of reponse

Attribute Type Required Description
result String yes Transaction information
checksum String yes The checksum code generated using the partner's result and checksum key

 


The value in the result after decoding:

Attribute Type Required Description
status Number Transaction status
error_code String Error code
failure_reason String không

Error description

amount Number Refunded Amount
order_code Number 9Pay's transaction ID
refund_no Number không 9Pay's refund transaction ID
request_id String Unique ID of each request

 

3. Query refund result

GET /v2/refunds/{request_id}/inquire

 

Reponse

Attribute Type Required Description
status Number Transaction status
error_code String Error code
failure_reason String không

Error description

amount Number Refunded Amount
order_code Number 9Pay's transaction ID
refund_no Number không 9Pay's refund transaction ID
request_id String Unique ID of each request

 

Example reponse:

{

    "request_id": "RF_56462",

    "refund_no": 42583024695127,

    "status": 2,

    "error_code": "999",

    "failure_reason": "Processing ",

    "amount": 74678,

    "order_code": 42580080605009

}