Refunding Payments

In the event that a payment needs to be canceled or refunded, you can use the /reverse_payment API call outside of the Embedded Form. If the payment has already been authorized and sent for settlement, the /reverse_payment call will refund the transaction. If the payment has not been sent for settlement, the /reverse_payment call will void the authorization and cancel the transaction before it is completed.

Use the following parameters when making a /reverse_payment call.

Parameter

Description

Type

Required

pnm_payment_identifier

A unique identifier generated with each payment.

string

R

agent_identifier

The name or ID of the merchant agent submitting the reversal.

string

O

void_if_not_settled

Set this parameter to true to completely cancel a payment that has not settled. The cutoff times for the cancellation window varies by card network and your site’s ACH submission timelines.

Settled payments must be refunded by submitting the refund_amount and refund_currency parameters. This call gives you the ability to refund both full and partial amounts.

bool

O

refund_amount

The full or partial amount you want to refund. This field is required for payments that have already been settled.

dec

O

refund_currency

USD

enum

O

site_identifier

The merchant's unique Site ID.

string

R

timestamp

The Unix Epoch time of the call.

string

R

version

The version of the API you’re using. This version must match the version associated with your API key pair.

string

R

signature

The HMAC signature that is calculated by running your API Secret Key and the alphabetized, concatenated parameters of the request’s payload through the SHA256 message digest algorithm.

string

R

curl --location --request POST 'https://api.paynearme-sandbox.com/reverse_payment' \
--data-raw '{
  "pnm_payment_identifier": "982519557603",
  "signature": "4dc23d5e706e8e7d3afa01f3d595c961e1a8483da4bdd944ac166cdb2ab7ebf9",
  "site_identifier": "S2155373459",
  "timestamp": "1648184110",
  "version": "3",
  "void_if_not_settled": true
}'
{
  "response_code": "0",
  "status": "ok",
  "payment": {
    "payment_made": "2022-11-16 09:57:22 -0800",
    "payment_amount": "504.99",
    "payment_currency": "USD",
    "payment_status": "cancelled",
    "payment_type": "ach",
    "payment_account": "Bank of America, NA 6655",
    "payment_method_identifier": "d041313f4c04c",
    "net_payment_amount": "500.00",
    "net_payment_currency": "USD",
    "payment_processing_fee": "4.99",
    "payment_processing_fee_currency": "USD",
    "pnm_processing_fee": "4.99",
    "pnm_processing_fee_currency": "USD",
    "settled_to_site": "false",
    "date_settled_to_merchant": "",
    "pnm_payment_identifier": "982519557603",
    "retailer_identifier": "FM690776428",
    "pricing_schedule_name": "agent",
    "site_channel": "agent",
    "merchant_settlements": {
      "merchant_settlement": {
        "settlement_method_identifier": "SM736220738",
        "settlement_type": "net_payment",
        "settlement_amount": "500.00",
        "settlement_currency": "USD"
      }
    }
  }
}