Make a sale transaction

Learn how to authorize and capture a sales transaction in one step using the API

Applies to:Developers

This guide explains how to make a sale (a money in payment transaction) with the Payabli API. This method authorizes and captures a payment in one step, so when a transaction is submitted, it’s immediately captured for settlement.

If aren’t using a stored payment method provided by an embedded component to run transactions, you must secure cardholder, bank account data, and customer IP address because your PCI scope is expanded.

To make a sale transaction, send a POST request to /api/MoneyIn/getpaid. This endpoint is used to process payments for all payment methods, including credit cards, ACH, stored methods, cash, check, and cloud payments.

The request requires several parameters, which can depend on the payment method used. The following are required for all payment methods:

  • entryPoint The ID of the paypoint making the sale
  • paymentMethod: Information about the payment method
  • paymentDetails Information about the payment itself
  • customerData Information about the customer

Although not required, we strongly recommend passing the ipaddress parameter. This is used for risk analysis and fraud prevention.

For a full list of available parameters, see the API reference for this endpoint.

Examples

Each of these examples runs a transaction for $100, with no service fee, for entrypoint f743aed24a and customer ID is 4440.The only difference in each example is the payment method used.

The Card payment method is used for credit and debit card payments.

POST
/api/MoneyIn/getpaid
1curl -X POST https://api-sandbox.payabli.com/api/MoneyIn/getpaid \
2 -H "requestToken: <apiKey>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "paymentDetails": {
6 "totalAmount": 100,
7 "serviceFee": 0
8 },
9 "paymentMethod": {
10 "cardcvv": "999",
11 "cardexp": "02/27",
12 "cardHolder": "John Cassian",
13 "cardnumber": "4111111111111111",
14 "cardzip": "12345",
15 "initiator": "payor",
16 "method": "card"
17 },
18 "customerData": {
19 "customerId": 4440
20 },
21 "entryPoint": "f743aed24a",
22 "ipaddress": "255.255.255.255"
23}'

The ACH payment method is used for ACH payments made with a bank account.

POST
/api/MoneyIn/getpaid
1curl -X POST https://api-sandbox.payabli.com/api/MoneyIn/getpaid \
2 -H "requestToken: <apiKey>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "paymentDetails": {
6 "totalAmount": 100,
7 "serviceFee": 0
8 },
9 "paymentMethod": {
10 "achAccount": "123123123",
11 "achAccountType": "Checking",
12 "achCode": "WEB",
13 "achHolder": "John Cassian",
14 "achHolderType": "personal",
15 "achRouting": "123123123",
16 "method": "ach"
17 },
18 "customerData": {
19 "customerId": 4440
20 },
21 "entryPoint": "f743aed24a",
22 "ipaddress": "255.255.255.255"
23}'

The Stored Method payment method is used for payments made with stored methods, either tokenized credit card or tokenized ACH account.

POST
/api/MoneyIn/getpaid
1curl -X POST https://api-sandbox.payabli.com/api/MoneyIn/getpaid \
2 -H "requestToken: <apiKey>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "paymentDetails": {
6 "totalAmount": 100,
7 "serviceFee": 0
8 },
9 "paymentMethod": {
10 "initiator": "payor",
11 "method": "card",
12 "storedMethodId": "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440",
13 "storedMethodUsageType": "unscheduled"
14 },
15 "customerData": {
16 "customerId": 4440
17 },
18 "entryPoint": "f743aed24a",
19 "ipaddress": "255.255.255.255"
20}'

The Cloud payment method is used for payments made with Cloud devices (payment terminals).

POST
/api/MoneyIn/getpaid
1curl -X POST https://api-sandbox.payabli.com/api/MoneyIn/getpaid \
2 -H "requestToken: <apiKey>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "paymentDetails": {
6 "totalAmount": 100,
7 "serviceFee": 0
8 },
9 "paymentMethod": {
10 "device": "6c361c7d-674c-44cc-b790-382b75d1xxx",
11 "method": "cloud",
12 "saveIfSuccess": true
13 },
14 "customerData": {
15 "customerId": 4440
16 },
17 "entryPoint": "f743aed24a",
18 "ipaddress": "255.255.255.255"
19}'

A successful request returns a 200 response with a JSON body. The transaction ID is returned as referenceId, this is used as the transId in other endpoints.

You can use the DeclinedPayment notification to get alerts for declined transactions, including both declined credit cards and declined ACH transactions. See Notifications and Webhooks Overview for more.
Response
1{
2 "isSuccess": true,
3 "responseData": {
4 "AuthCode": "AuthCode",
5 "avsResponseText": "No address or ZIP match only",
6 "CustomerId": 4440,
7 "cvvResponseText": "CVV2/CVC2 no match",
8 "methodReferenceId": null,
9 "ReferenceId": "45-erre-324",
10 "ResultCode": 1,
11 "ResultText": "Approved"
12 },
13 "responseText": "Success"
14}

If the payment is declined, the responseText reads Declined, and resultText contains the reason for the decline.

Decline example
1 {
2 "isSuccess": false,
3 "responseData": {
4 "AuthCode": "null",
5 "avsResponseText": "No address or ZIP match only",
6 "CustomerId": 4440,
7 "cvvResponseText": "CVV2/CVC2 no match",
8 "ReferenceId": "45-erre-324",
9 "ResultCode": 1,
10 "ResultText": "200: Transaction was declined by processor.. DECLINE"
11 },
12 "responseText": "Declined"
13 }

Next steps

You can view transactions in the UI in your PayHub or PartnerHub account, or you can get lists of transactions via the API for paypoints or organizations