Look Up a Purchase Transaction
You can look up an existing purchase transaction by making a GET request to the purchases endpoint containing the account number and transaction ID in the URL.
GET /directdebit/v1/accounts/account_id/purchases/purchase_id
curl -X GET https://api.test.paysafe.com/directdebit/v1/accounts/89987201/purchases/a02e52c7-c991-4418-966a-b62989cb0eae \
-u devcentre322:B-qa2-0-53625f86-302c021476f52bdc9deab7aea876bb28762e62f92fc6712d0214736abf501e9675e55940e83ef77f5c304edc7968 \
-H 'Content-Type: application/json'
Prior to trying the example, you should:
- Replace the account_id (89987201) in the URL with the test account number you received.
- Replace the API key (after the -u) with the API key you received.
- Replace the purchase_id (a02e52c7-c991-4418-966a-b62989cb0eae) in the URL with your purchase ID returned in the response to the initial purchase request.
You can look up transactions using a transaction ID to a maximum of one year in the past.
{
"links": [
{
"rel": "self",
"href": "https://api.test.paysafe.com/directdebit/v1/accounts/89987201/purchases/a02e52c7-c991-4418-966a-b62989cb0eae"
}
],
"id": "a02e52c7-c991-4418-966a-b62989cb0eae",
"txnTime": "2016-12-14T15:12:18Z",
"status": "PENDING",
"merchantRefNum": "123456789",
"amount": 2599,
"customerIp": "192.0.126.111",
"dupCheck": true,
"ach": {
"accountHolderName": "First Company",
"accountType": "CHECKING",
"payMethod": "WEB",
"routingNumber": "211589828",
"paymentDescriptor": "Transaction",
"lastDigits": "09"
},
"profile": {
"firstName": "John",
"lastName": "Johnson",
"email": "john.johnson@emailserver.com",
"ssn": "123456789",
"dateOfBirth": {
"day": 24,
"month": 10,
"year": 1981
}
},
"billingDetails": {
"street": "100 Queen Street West",
"street2": "Apt. 55",
"city": "Ottawa",
"state": "ON",
"country": "CA",
"zip": "M1M 1M1",
"phone": "6139991100"
}
}
If you do not have a transaction ID, you can look up a transaction based on the merchantRefNum you supplied with the original request.
curl -X GET https://api.test.paysafe.com/directdebit/v1/accounts/89987201/purchases?merchantRefNum=merchant-ABC-123&limit=2 \
-u devcentre322:B-qa2-0-53625f86-302c021476f52bdc9deab7aea876bb28762e62f92fc6712d0214736abf501e9675e55940e83ef77f5c304edc7968 \
-H 'Content-Type: application/json'
The query string parameter added to the API endpoint for a lookup using a merchant reference number must be in the format shown in the following example:
GET /directdebit/v1/accounts/account_id/purchases?merchantRefNum=merchant_ref_number
If the merchantRefNum value you are using is not unique (i.e., you have switched off the duplicate transaction check and are using the same merchant reference number for multiple transactions), then the lookup response will contain the last 10 records linked to the merchantRefNum. You can specify the exact number of records to retrieve in by appending the limit parameter to the end of your API endpoint, for example:
/directdebit/v1/accounts/account_id/purchases?merchantRefNum=merchant_ref_number&limit=N,
Where N = the number of records to return (Max value is 50).
{
"links": [
{
"rel": "self",
"href": "https://api.test.paysafe.com/directdebit/v1/accounts/1001058140/purchases?merchantRefNum=merchant-ABC-123&limit=2"
},
{
"rel": "next",
"href": "https://api.test.paysafe.com/directdebit/v1/accounts/1001058140/purchases?merchantRefNum=merchant-ABC-123&limit=2&offset=4&startDate=2016-07-13T19:15:45Z&endDate=2016-08-12T19:15:45Z"
},
{
"rel": "previous",
"href": "https://api.test.paysafe.com/directdebit/v1/accounts/1001058140/purchases?merchantRefNum=merchant-ABC-123&limit=2&offset=0&startDate=2016-07-13T19:15:45Z&endDate=2016-08-12T19:15:45Z"
}
],
"purchases": [
{
"id": "a02e52c7-c991-4418-966a-b62989cb0eae",
"txnTime": "2016-12-14T15:12:18Z",
"status": "PENDING",
"merchantRefNum": "merchant",
"amount": 2599,
"customerIp": "192.0.126.111",
"ach": {
"accountHolderName": "First Company",
"accountType": "CHECKING",
"payMethod": "WEB",
"routingNumber": "211589828",
"paymentDescriptor": "Transaction",
"lastDigits": "09"
},
"profile": {
"firstName": "John",
"lastName": "Johnson",
"email": "john.johnson@emailserver.com",
"ssn": "123456789",
"dateOfBirth": {
"day": 24,
"month": 10,
"year": 1981
}
},
"billingDetails": {
"street": "100 Queen Street West",
"street2": "Apt. 55",
"city": "Ottawa",
"state": "ON",
"country": "Canada",
"zip": "M1M 1M1",
"phone": "6139991100"
},
"links": {
"rel": "self",
"href": "https://api.test.paysafe.com/directdebit/v1/accounts/1001058140/purchases/a02e52c7-c991-4418-966a-b62989cb0eae"
}
},
{
"id": "4c99e967-517e-4610-b3bf-364d6b3492a1",
"txnTime": "2016-12-14T15:12:18Z",
"status": "PENDING",
"merchantRefNum": "merchant",
"amount": 2599,
"customerIp": "192.0.126.111",
"ach": {
"accountHolderName": "First Company",
"accountType": "CHECKING",
"payMethod": "WEB",
"routingNumber": "211589828",
"paymentDescriptor": "Transaction",
"lastDigits": "09"
},
"profile": {
"firstName": "John",
"lastName": "Johnson",
"email": "john.johnson@emailserver.com",
"ssn": "123456789",
"dateOfBirth": {
"day": 24,
"month": 10,
"year": 1981
}
},
"billingDetails": {
"street": "100 Queen Street West",
"street2": "Apt. 55",
"city": "Ottawa",
"state": "ON",
"country": "Canada",
"zip": "M1M 1M1",
"phone": "6139991100"
},
"links": {
"rel": "self",
"href": "https://api.test.paysafe.com/directdebit/v1/accounts/1001058140/purchases/4c99e967-517e-4610-b3bf-364d6b3492a1"
}
}
]
}
For more information, including cancelling a purchase and processing a standalone credit, see our API Reference section.