DropPay API - Shop v.1 - POS - Refund¶
Every charge can be refunded up to its amount
.
Warning
Only a merchant is authorized to refund a previously executed charge. So your application must act on behalf of the DropPay Business account owner who is the merchant party of the authorization that enabled the charge you want to refund.
Read Connection API reference first!
Refund your customer¶
In order to refund your customer you just POST a new Refund entity reffering a previously successful charge.
You can refund, only once, up to the referred charge amount.
For example if charge.amount
was 100.00
you could set
"amount": 54.72
in the refund request. Only the partial amount will be refunded to DropPay user.
REST Entities¶
Every REST entity is described listing her properties with the following formatting conventions:
- this is a property name
this is an example of property value
- (type, policy, direction) is the specification of a property
- type can be "string", "number", "object" or a proper object class name
- policy can be "optional" or "required"
- direction can be "posted" or "received" depending on whether you set it in the request or you got it from the response
- after the dash "-" there's the property description
name: example_value
(type, policy, direction) - Property description
Refund¶
Properties
id
:CHRV85NM121PY
(string, returned) - Refund resource unique IDcharge_id
:CHAQA34B31FJ9
(string, posted) - Charge ID passed is as property when creating the refund.reason
wrong order #2316
(string, posted) - Refund reason or.. whatever. Max 512 chars.date_creation
:2016-07-16T19:20:30+01:00
(string, returned) - Refund creation date/time. Format ISO-8061date_last_update
:2016-07-16T19:20:30+01:00
(string, returned) - Refund last update date/time. Format ISO-8061status
:DONE
(string, returned) - Status label, one of [DONE,FAILED, ACCOUNTED
]amount
:25.00
(number, posted) - Amount of refund. Must be less or equal to the amount of referred charge (DropPay supports only Euro currency)
REST Endpoints¶
DropPay POS API publishes two methods :
- POST a new Refund entity to cash money back to DropPay user;
- GET the Refund entity to read the procedure status;
Security¶
Requests must be authenticated with User Access Token. User Access Token can be obtained requesting it with and active Connection Code.
Details at Authentication v.1 API Reference
POST - Refund a charge¶
Example¶
Request¶
curl --request POST
--url https://api.drop-pay.io/shop/v1/pos/refund
--header 'autorization: Bearer or872y08472fhcbqc8714pquiwcnbwtwfwc'
{
"charge_id": "CHAQA34B31FJ9",
"amount": 20.00,
"reason": "wrong order #2316"
}
Response 200¶
{
"id": "CHRV85NM121PY",
"charge_id": "CHAQA34B31FJ9",
"amount": 20.00,
"reason": "wrong order #2316",
"date_creation": "2016-07-16T19:20:30+01:00",
"status": "ENQUEUED"
}
GET - Verify a refund¶
Example¶
Request¶
curl --request GET
--url https://api.drop-pay.io/shop/v1/pos/refund/CHRV85NM121PY
--header 'autorization: Bearer or872y08472fhcbqc8714pquiwcnbwtwfwc'
Response 200¶
{
"id": "CHRV85NM121PY",
"charge_id": "CHAQA34B31FJ9",
"amount": 20.00,
"reason": "wrong order #2316",
"date_creation": "2016-07-16T19:20:30+01:00",
"status": "DONE",
"date_last_update": "2016-07-16T19:20:30+01:00",
}
Errors handling¶
DropPay POS API is built around REST paradigm so HTTP Status code are consistently informing about what happened running your request.
See DropPay Common Errors for details about global common errors.