Create a cash payment

Localpayment enables merchants to process payments through cash networks, allowing customers to pay with physical currency at authorized locations. This guide outlines the process for initiating cash payments through Localpayment's API, detailing required parameters, handling responses, and interpreting status codes for seamless integration with cash payment networks.

Note: Cash payments expire in 7 days by default. The expiration period can be adjusted between 1-7 days by contacting our support team.

Before You Begin

Ensure you have:


Step 1: Create Cash Payment

To generate a cash payment reference, send a POST request to the Create Payin endpoint with cash-specific parameters.

Key Request Parameters

The request requires several key parameters specific to cash payments:

ObjectDescriptionRequired
paymentMethod.typeMust be Cash
paymentMethod.codeCash payment method code (country-specific)
payerPayer information for compliance
merchantMerchant/business details
amountTransaction amount
currencyTransaction currency code
countryCountry code where payment will be made

See all available parameters in the request.

Example Request

Below is an example using curl:

curl --request POST \
     --url https://api.stage.localpayment.com/api/payin/ \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'Authorization: Bearer <your_access_token>' \
     --data '
{
    "paymentMethod": {
        "type": "Cash",
        "code": "1801",
        "flow": "DIRECT"
    },
    "externalId": "f3913fda-c33b-494a-a134-9d37f0421e2a",
    "country": "GTM",
    "amount": 1001.0,
    "currency": "GTQ",
    "accountNumber": "{{accountNumber}}",
    "conceptCode": "0003",
    "comment": "Add any relevant information related to the transaction",
    "merchant": {
        "type": "COMPANY",
        "name": "My merchant",
        "document": {
            "type": "NIT",
            "id": "36029785"
        }
    },
    "payer": {
        "type": "INDIVIDUAL",
		"name": "John",
		"lastname": "Doe",
        "email": "[email protected]",
		"document": {
			"id": "3463426000101",
			"type": "CUI"
		}
    }
}
'

Step 2: Handle the Response

Successful Response

A successful cash payment creation includes the payment reference and cash network details:

{
    "transactionType": "PayIn",
    "externalId": "f3913fda-c33b-494a-a134-9d37f0421e2a",
    "internalId": "775558a4-7a71-4163-bc02-5bf6faa45c0b",
    "paymentMethod": {
        "type": "Cash",
        "code": "1801",
        "flow": "DIRECT"
    },
    "country": "GTM",
    "currency": "GTQ",
    "amount": 1001.0,
    "accountNumber": "{{accountNumber}}",
    "confirmed": {
        "currency": "GTQ",
        "amount": 1001.0,
        "fxQuote": 1.0
    },
    "payment": {
        "currency": "GTQ",
        "fxQuote": 1.0,
        "financingFee": 0.0,
        "amount": 1001.0
    },
    "localTaxes": [],
    "withHoldings": [],
    "fees": {
        "description": "Fee",
        "currency": "GTQ",
        "fxSource": 7.66433259,
        "fxQuote": 1.0,
        "amount": 0.0,
        "account": "{{accountNumber}}"
    },
    "status": {
        "code": "100",
        "description": "INPROGRESS",
        "detail": "The payin is pending the confirmation"
    },
    "ticket": {
        "image": "https://api.stage.localpayment.com/api/images/Code128/4201762961253259",
        "barcode": "4201762961253259",
        "expirationDate": "2025-11-19T15:27:32.8241946"
    },
    "merchant": {
        "type": "COMPANY",
        "name": "My merchant",
        "document": {
            "type": "NIT",
            "id": "36029785"
        }
    },
    "payer": {
        "type": "INDIVIDUAL",
        "name": "John",
        "lastname": "Doe",
        "document": {
            "type": "CUI",
            "id": "3463426000101"
        },
        "email": "[email protected]"
    },
    "intermediaries": [],
    "date": {
        "creationDate": "2025-11-12T15:27:30.888+00:00",
        "processedDate": "2025-11-12T15:27:33.3566208",
        "expirationDate": "2025-11-19T15:27:32.8241946"
    },
    "errors": []
}

Key Response Fields

ParameterDescriptionUse Case
ticket.imageURL to the barcode imageDisplay scannable barcode to customer.
ticket.barcodeBarcode numeric valueAlternative to image for barcode generation.
ticket.expirationDateWhen the payment ticket expiresDisplay countdown and handle expiration.
externalIdYour original reference numberInternal reconciliation and tracking.
status.codeCurrent transaction state (100 = INPROGRESS)Determine next steps in payment flow.
date.creationDateWhen transaction was created.Analytics and performance tracking.

Error Response

When cash payment creation fails, you'll receive detailed error information:

{
    "externalId": "f3913fda-c33b-494a-a134-9d37f0421e2a",
    "internalId": "899b95ed-64b0-4d61-8203-734792707dbf",
    "status": {
        "code": "300",
        "description": "REJECTED"
    },
    "errors": [
        {
            "code": "300",
            "detail": "Invalid param + [payer.email] + must not be null"
        }
    ]
}

Step 3: Present Payment Instructions to Customer

After successfully creating a cash payment, provide clear instructions to the customer:

  1. Display Payment Ticket: Show the barcode image prominently.
  2. Provide Barcode Number: Display the numeric barcode value as alternative.
  3. Set Expiration Expectations: Clearly communicate the payment deadline.
  4. Provide Step-by-Step Guide: Explain the payment process at authorized locations.
  5. Include Support Information: Provide customer support contact details.

Best Practices for Payment Presentation

  • Display barcode image in high resolution for easy scanning.
  • Show numeric barcode value as backup for manual entry.
  • Include clear expiration date and countdown timer.
  • Provide instructions for payment location procedures.
  • Send payment reminders as expiration approaches.
  • Ensure mobile-responsive display for on-the-go customers.

Step 4. Track Transaction Status

After initiating a cash payment, monitor its progress through these methods:

Common Status Codes

The Localpayment API provides various status codes to indicate the progress and outcome of cash payments.

CodeStatusDescription
100INPROGRESSPayment ticket created, waiting for customer payment.
300REJECTEDInvalid params

📝

Note: For complete status code reference, see the Transaction Status documentation.


Testing Your Integration

Test Scenarios

Verify your integration handles these scenarios:

  1. Successful Payment Creation: Generate valid cash payment tickets with barcodes
  2. Payment Expiration: Handle expired payment tickets gracefully
  3. Duplicate External ID: Manage duplicate reference errors
  4. Status Updates: Webhook handling and status polling.

Next Steps

After creating a cash payment, you may need to perform additional actions: