Standard errors representation
Standard errors representation
When you send a request to the PPRO Global API and the request is rejected outright (e.g. in the presence of a system failure), you will receive a HTTP 400s/500s error:
- If a request is invalid (HTTP 400)
- If there was a system failure like failing to reach out to a database (HTTP 500)
- If a client tried to GET a charge or an operation using an unknown id (HTTP 404)
- If an operation was attempted against an unknown charge id (HTTP 400)
- If a charge was created using an unknown instrument id (HTTP 400)
- If GPG refused to process an operation due to invalid request parameters or charge state, like trying to refund a non-captured charge, trying to capture/refund/void using an invalid amount for some charge, etc (HTTP 400)
These responses have the following format:
{
"status": 404,
"message": "Payment charge not found",
"timestamp": "2022-11-03T11:23:47.123Z"
}
Failures and Declines in Accepted Requests
When you send a request to create a Payment Charge, Payment Agreement or Payment Report operation, the request may be accepted for processing by our system, but the desired operation could not be fulfilled. In these cases, you will receive a HTTP 200 response with the created entity, which contains information about the failure.
Example responses for failed Payment Charge operations:
Response (HTTP 200):
{
"id": "charge_UyreKG7bBuHE8VhwhpG8I",
"paymentMethod": "KLARNA_BNPL",
"status": "FAILED",
"failure": {
"failureType": "PROVIDER_DECLINE",
"internalFailureCode": "some-internal-failure-code",
"providerFailureCode": "some-provider-failure-code",
"failureMessage": "Failed to create credit session"
},
"authorizations": [
{
"id": "authz_zNSICpiwfevcOwcZGgqVJ",
"amount": 15000,
"status": "FAILED",
"failure": {
"failureType": "PROVIDER_DECLINE",
"failureCode": "some-internal-failure-code",
"providerFailureCode": "some-provider-failure-code",
"failureMessage": "Failed to create credit session"
},
}
],
... // other fields
}
Response (HTTP 200):
{
"id": "refund_yT763oF6Z6m3xlDsd122V",
"amount": 1000,
"status": "FAILED",
"failure": {
"failureType": "PROVIDER_DECLINE",
"internalFailureCode": "internal-failure-code",
"providerFailureCode": "provider-failure-code",
"failureMessage": "Refund was declined"
},
}
Every failed Authorization, Capture, Refund and Void operation includes a failure
object with the following fields:
Field | Description |
---|---|
failureType | An Enum with 4 possible values:INTERNAL_ERROR if there was an error while processing in PPRO's systemINTERNAL_DECLINE if PPRO determines the operation should be declinedPROVIDER_ERROR if there was an error while processing in an upstream provider's systemPROVIDER_DECLINE if an upstream provider determines the operation should be declined |
failureCode | An optional failure code generated by PPRO |
providerFailureCode | An optional failure code generated by the upstream provider |
failureMessage | A message describing the failure |
A Payment Charge will always contain a copy of the most recent failure that has occurred in an underlying Authorization, Capture, Refund or Void.