PayFacto API - v1.0 - POST /v1/redirect/GetResponse
PayFacto API - v1.0 - POST /v1/redirect/GetResponse
Retrieves the result of a hosted payment session after the cardholder has been redirected back to the merchant's success or failure URL. Called immediately following the redirect from /v1/redirect/CreatePurchaseSession. After retrieving the result, the merchant must issue either a /v1/ack to accept the transaction or a /v1/nack to refuse it within 3 minutes of the original transaction response or PayFacto will automatically reverse the transaction.
π
API Key
Generate your API key from the Payments Manager: Administrator Client β API Key β Add New Key. Pass it as auth-api-key in every request.
πͺ
Company & Merchant Numbers
Your CompanyNumber (5-digit) and MerchantNumber (8-digit) are issued by PayFacto during onboarding. Both are required on every Redirect Get Response request.
π¦
Request Format β Base64-Encoded Payload
Requests use HTTP POST with an application/x-www-form-urlencoded body. Assemble all parameters as a cleartext query string, Base64-encode it, then send: auth-api-key={key}&payload={base64}. This endpoint does not require card data, amounts, or invoice numbers.
π
Hosted Payment Flow β Step 2 of 3
This endpoint is the second step in the hosted payment redirect flow:
| Step | Action | Endpoint |
|---|
| 1 | Create a hosted payment session and redirect the cardholder to the returned sessionUrl to enter their payment details | /v1/redirect/CreatePurchaseSession |
| 2 β You are here | After the cardholder is redirected back to your URL, call this endpoint to retrieve the payment result and the transactionNumber | /v1/redirect/GetResponse |
| 3 | Accept the transaction or refuse it within the required time window | /v1/ack or /v1/nack |
β±οΈ
ACK or NACK Required β See Timing on the ACK Page
After calling this endpoint, a /v1/ack or /v1/nack must be sent using the transactionNumber returned in this response. Refer to the ACK documentation for the time window and consequences of missing it.
π
Read-Only Operation
This endpoint retrieves the payment result only. No transaction is processed and no record is modified by this call. The transaction is not confirmed until a subsequent /v1/ack is accepted.
βΉοΈ
All parameters are passed inside the Base64-encoded payload form field. Raw body format: auth-api-key=<key>&payload=<base64>. This endpoint does not require card data, amounts, or invoice numbers.
Required fields
| Field | Type | Description |
|---|
| CompanyNumber | Numeric(5) | Identifies the merchant on PayFacto's network. Provided by PayFacto during onboarding. Example: 12345 |
| MerchantNumber | Numeric(8) | Identifies the merchant to PayFacto's network. Provided by the integration team. Example: 53400000 |
| LanguageCode | Alphanumeric(1) | Language for PayFacto responses. F = French, E = English. |
| OperatorID | Alphanumeric(8) | Identifies the cashier, agent, or system that initiated the request. Example: USER0001 |
| TransactionNumber | Numeric(12) | The PayFacto gateway transaction identifier returned as a query parameter when the cardholder was redirected back to the merchant URL after completing the hosted payment form. Example: 000111222333 |
3
Request β Code Example
β οΈ
The example below uses the test endpoint and a sandbox API key. Replace credentials and base URL before going live. Use the TransactionNumber received as a query parameter on the redirect back to your URL from the hosted payment form.
cURL
# Redirect Get Response -- POST /v1/redirect/GetResponse
# Step 1: Build the cleartext payload
# TransactionNumber comes from the redirect back to your success/failure URL
PAYLOAD="CompanyNumber=12345&MerchantNumber=53400000&LanguageCode=E&OperatorID=USER0001&TransactionNumber=000111222333"
# Step 2: Base64-encode the payload
ENCODED=$(echo -n "$PAYLOAD" | base64)
# Step 3: Submit the request
curl -X POST "https://test.api.payfacto.cloud/v1/redirect/GetResponse" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "auth-api-key=YOUR_TEST_API_KEY&payload=$ENCODED"
# Step 4: After inspecting the response, immediately send ACK or NACK
# using the transactionNumber returned below
Always returned
| Field | Type | Description |
|---|
| returnCode | Alphanumeric(4) | Identifies the result of the session retrieval. 00 = payment result retrieved successfully. All other values indicate a failure. Refer to Section 6 for endpoint-specific codes. |
| serverNumber | Alphanumeric(4) | Identifies the PayFacto Network server that processed the request. |
| timeStamp | Alphanumeric(17) | Date and time the request was processed. Format: YYYYMMDD-HHMMSSCC. Example: 20240601-10000100 |
Conditionally returned β Payment result
Returned when returnCode is 00 and the cardholder completed the hosted payment form. Store the transactionNumber and authorizationNumber immediately β both are required for receipt display and the subsequent ACK or NACK call.
| Field | Type | Description |
|---|
| transactionNumber | Numeric(12) | β
Pass to ACK or NACK. The PayFacto gateway transaction identifier for this payment. Must be passed as TransactionNumber in the subsequent /v1/ack or /v1/nack call. Example: 000111222333 |
| authorizationNumber | Alphanumeric(8) | Authorization code from the issuing bank. Must be displayed on the customer receipt. Example: APPROV01 |
| amount | Numeric(11) | Amount charged to the cardholder, left (0) padded. Example: 00000010000 = $100.00 |
| invoiceNumber | Alphanumeric(12) | Echo of the InvoiceNumber submitted when creating the session via /v1/redirect/CreatePurchaseSession. |
| cardNumber | Alphanumeric(40) | Masked card number used for the payment. |
| cardType | Alphanumeric(1) | Card brand used for the payment. A = Amex, M = Mastercard, V = Visa, I = Diners, O = Discover. |
| errorDescription | Alphanumeric(50) | Only returned when the request fails (non-00 returnCode). Human-readable description of the failure reason. |
5
Response β Code Example
JSON β 200 Success (cardholder completed hosted payment form)
{
"returnCode": "00",
"serverNumber": "0001",
"timeStamp": "20240601-10000100",
"transactionNumber": "000111222333",
"authorizationNumber": "APPROV01",
"amount": "00000010000",
"invoiceNumber": "PUR000000001",
"cardNumber": "411111XXXXXX1111 ",
"cardType": "V"
}JSON β Error
{
"returnCode": "9006",
"errorDescription": "INVALID COMPANY NUMBER",
"serverNumber": "0001",
"timeStamp": "20240601-10000200"
}The following codes are most relevant to this endpoint. For the complete catalogue see the Return Code Index.
| Return Code | Meaning | When it occurs | Recommended Action |
|---|
| 00 | Payment result retrieved | The hosted payment session result was retrieved successfully. | Store the transactionNumber and authorizationNumber immediately. Send /v1/ack to accept the payment or /v1/nack to refuse it. Refer to the ACK page for timing requirements. |
| 9004 | "Null" value: company number | CompanyNumber is null or blank in the payload. | Check your application. The field must correspond to the specification in the documentation. |
| 9005 / 9006 | Invalid / rejected: company number | CompanyNumber does not match the required 5-digit length or is not configured in the payment solution. | Make sure the application uses the correct company number provided by PayFacto. If it does, contact PayFacto customer service. |
| 9007 | "Null" value: merchant number | MerchantNumber is null or blank in the payload. | Check your application. The field must correspond to the specification in the documentation. |
| 9008 / 9009 | Invalid / rejected: merchant number | MerchantNumber does not match the required 8-digit length or is not configured in the payment solution. | Make sure the application uses the merchant number provided by PayFacto. If it does, contact PayFacto customer service. |
| 9051 | Time out | Request processing timed out. | Retry the request immediately. Be aware the ACK/NACK window is running. If the problem persists, contact PayFacto customer service. |
| 9049 / 9050 | Fatal error | A critical error occurred while processing the request. | Retry the request immediately. Be aware the ACK/NACK window is running. If the problem persists, contact PayFacto customer service.
|