Using Authorization Callbacks
Authorization callbacks enable you to control which consumers can make payments and when. Payment attempts trigger authorization callbacks to the merchant before the transaction is sent for processing.
The authorization callback allows you to perform the following tasks:
- Decline unwanted payments such as the following:
- Transactions containing expired offers,
- Transactions where the payment amount is over regulatory or risk limits,
- Transactions from a consumer account with frequent chargebacks and/or returns.
- Provide up to 3,000 characters of customized, dynamic text for the receipt. Use this text to deliver valuable consumer information, such as instructions, points programs, account status, or special offers based on the consumer’s purchase history.
Available Customizations
Clients can configure their Authorization callbacks to exclude certain payment scenarios. Specifically, the callback can be skipped for:
- Payments initiated via the API using the /make_payment endpoint,
- Payments that are part of a recurring autopay schedule,
- Future-dated, one-time payments.
This customization allows for more streamlined processing by eliminating unnecessary callbacks for automated or scheduled transactions.
In addition to customizing when the Authorization callback is made, clients can also customize what parameters are returned with the callback. For example, if your site does not accept cash payments, you may want to exclude the payment_longitude
, payment_latitude
, retailer_location_address
, retailer_location_identifier
, and retailer_name
from the payload of your Authorization callbacks.
Other excludable parameters are marked in the Request Parameters table. To make any of these customizations, consult your PayNearMe Technical Account Manager.
Request Parameters
For electronic transactions (e.g., non-cash payments), PayNearMe automatically initiates the authorization callback after the consumer submits his/her payment data. For cash transactions, the retailer initiates the authorization callback after scanning the consumer’s Token (e.g., barcode or QR code). Once initiated, the callback pings a handler endpoint that you’ve set up on your server. This ping notification can include the following parameters:
Parameter | Description | Type | Excludable? |
---|---|---|---|
site_identifier | The ID that identifies your merchant site. | string | |
pnm_payment_identifier | A unique string ID that PayNearMe generates with each payment. | string | |
site_customer_identifier | A unique string ID the merchant creates to identify consumers. | string | |
site_order_identifier | A unique string ID the merchant creates to identify the order. | string | |
due_to_site_amount | The amount due to the merchant at settlement | dec | |
due_to_site_currency | USD | enum | |
net_payment_amount | The payment amount after taking out the Site Processing Fee, PNM Processing Fee, and if applicable, the Retailer’s Fee. | dec | |
net_payment_currency | USD | enum | |
payment_amount | The total payment amount the consumer submitted online or paid to the retailer. | dec | |
payment_currency | USD | enum | |
payment_date | The date of the payment in Epoch Standard time. | string | |
pnm_withheld_amount | The total amount withheld by PayNearMe that is shared with the retailer, site, and parent site, if applicable. | dec | |
pnm_withheld_currency | USD | enum | |
payment_card_type | The type of debit or credit card payment method. | string | |
payment_card_last4 | The last four digits of the credit or debit card used in the payment. | string | |
payment_bank_name | The name of the consumer’s bank. | string | |
payment_bank_last4 | The last four digits of the bank account used in the payment. | string | |
payment_longitude | The longitudinal coordinate of the retail location the consumer selected for his/her cash payment. NOTE: Only included for cash transactions. | string | ✔️ |
payment_latitude | The latitudinal coordinate of the retail location the consumer has selected for his/her cash payment. NOTE: Only included for cash transactions. | string | ✔️ |
retailer_location_address | The street address and state of the retailer location. NOTE: Only included for cash transactions. | string | ✔️ |
retailer_location_identifier | The PayNearMe-defined ID for the retailer location. NOTE: Only included for cash transactions. | enum | ✔️ |
retailer_name | The name of the retailer. NOTE: Only included for cash transactions. | string | ✔️ |
pnm_order_identifier | The unique, PayNearMe-generated ID for this order. | string | |
pnm_processing_fee | The amount of the processing fee that PayNearMe charges. | dec | |
pnm_processing_currency | USD | enum | |
site_order_annotation | A merchant-provided description of the order. This field is only echoed in the callback if the site_order_annotation parameter was included in the originalcreate_order request. | string | |
site_processing_fee | The amount of the Retailer’s processing fee. | dec | |
site_processing_currency | USD | enum | |
payment_type | The type of funding method the consumer used for the transaction. Supported values include the following:
| enum | ✔️ |
payment_method_identifier | The unique identifier (i.e., token) for the payment method account. | string | ✔️ |
site_channel | Indicates the source of the transaction. Supported options include the following:
| enum | |
site_subchannel | Indicates whether the transaction was a scheduled transaction. Supported options include the following:
| enum | ✔️ |
agent_name | The first and last name of the agent that created the payment. This field is only returned for immediate payments made by agents in the Embedded Form. It will not display for recurring or scheduled payments. | string | ✔️ |
agent_email | This field is only returned for immediate payments made by agents in the Embedded Form. It will not display for recurring or scheduled payments. | string | ✔️ |
pricing_schedule_name | Specifies the pricing category associated with the payment. Supported options include the following:
| enum | |
settlement_method | The ID of the bank account where funds for this payment will be settled. | string | ✔️ |
signature | The HMAC signature of the callback (v3.0) or the MD5 signature of the callback (v2.0) used to authenticate it as a genuine PayNearMe callback. | string |
Response Parameters
Once you receive the authorization callback, you have 10 seconds to approve or decline the transaction with a response containing the following parameters:
Response Parameter | Description | Type | Req |
---|---|---|---|
pnm_order_identifier | The unique, PayNearMe-generated ID for this order. | string | R |
accept_payment | Indicates whether you want to accept the payment. Supported values for this field include the following:
| enum | R |
site_payment_identifier | An arbitrary, merchant-defined string that identifies the payment. If specified, PayNearMe will echo this value back during the Confirmation callback. To correlate Authorization and Confirmation calls, use the pnm_payment_identifier parameter rather than the site_payment_identifier . | string | O |
decline_reason | A customized text string that indicates the reason the authorization was declined. The string may be static or dynamically generated and may optionally include parameters for data to be supplied by PayNearMe. | string | O |
receipt | Up to 3,000 characters of a customized text string for the receipt. The string may be static or dynamically generated and may optionally include parameters for data to be supplied by PayNearMe. Receipt verbiage must adhere to the following specifications:
| string | O |
If PayNearMe does not receive a response to the authorization callback, the transaction is automatically voided.
Velocity Limits
PayNearMe enforces velocity limits for each consumer regardless of callback status. These limits include a rolling, per 24-hour limit (e.g., $500 for cash payments) and a rolling, per 30-day limit (e.g., $10,000 for cash payments) for each payment type. If a consumer attempts to make payments that exceed these limits, PayNearMe will automatically decline the transaction without sending the Authorization callback to the merchant.
Sample Code
The following code samples display a sample callback request and an approved and declined server response from:
{
"pnm_order_identifier": "87549788233",
"pnm_payment_identifier": "646587045351",
"site_order_identifier": "276900000",
"site_customer_identifier": "276900000",
"site_payment_identifier": "SPI-123",
"version": "3.0",
"net_payment_amount": "150.00",
"net_payment_currency": "USD",
"payment_amount": "150.00",
"payment_currency": "USD",
"timestamp": "1742415312",
"status": "payment",
"pnm_withheld_amount": "1.00",
"pnm_withheld_currency": "USD",
"due_to_site_amount": "149.00",
"due_to_site_currency": "USD",
"standin": "false",
"payment_timestamp": "2025-03-19 13:15:11 -0700",
"order_payee_identifier": "S9150977386",
"settlement_method": "SM685563976",
"payment_type": "ach",
"payment_method_identifier": "e2bbc1324d126",
"site_identifier": "S9150977386",
"payment_bank_name": "JPMorgan Chase",
"payment_bank_last4": "5044",
"site_channel": "consumer",
"pricing_schedule_name": "consumer",
"signature": "826ce38202f6c041ed1b242ba34b44ef283e151629e4143f216cef7db630666b"
}
{
"payment_authorization_response": {
"version":"3.0",
"authorization": {
"pnm_order_identifier":"87549788233",
"accept_payment":"yes",
"receipt":"^Thank you for your payment<br>^of $<pnm_payment /> to Beaver County Water Authority.<br>^For questions call 555-555-5555.",
"memo":"2025-03-19 12:21:45 -0700",
"site_payment_identifier":"SPI-123"
}
}
}
{
"payment_authorization_response": {
"version":"3.0",
"authorization": {
"pnm_order_identifier":"87549788233",
"accept_payment":"no",
"decline_reason":"Account Suspended",
"receipt":"^Payments cannot be made at this time.<br>^Please call Customer Service at 555-555-5555.",
"memo":"2025-03-19 12:21:45 -0700",
"site_payment_identifier":"SPI-123"
}
}
}
Updated 1 day ago