Making Payments
Once the payment method token has been created, you can use it to make a one-time or scheduled payment immediately or use the [/make_payment](https://paynearme-enterprise-group.readme.io/paynearme-devdocs/reference/post_make-payment)
API call at a later time.
Make an Immediate One-Time Payment
Use the pay=1
parameter to make an immediate one-time payment from the Embedded Form. For example, if you wanted to create a payment form that makes an immediate payment, you could use the following script:
<script src="https://www.paynearme-sandbox.com/api/embedded/Ku6z6P5enC2PiTvrpazZ1g/script.js?pay=1&button=Pay"></script>
After selecting an existing payment method or creating a new payment method, the Embedded Form renders the following screen requesting a payment amount and providing payment authorization verbiage:

Create an Immediate Autopay Schedule
Use the schedule=1
option to create a schedule of recurring payments for the consumer:
<script src="https://www.paynearme-sandbox.com/api/embedded/Ku6z6P5enC2PiTvrpazZ1g/script.js?schedule=1&button=Pay"></script>
After selecting an existing payment method or creating a new payment method, the Embedded Form renders the following Set Recurring Autopay screen:

Make a Payment Using the API
Use the [/make_payment](https://paynearme-enterprise-group.readme.io/paynearme-devdocs/reference/post_make-payment)
API endpoint to create payments at a later date or time using the stored payment methods collected by agents. To create a [/make_payment](https://paynearme-enterprise-group.readme.io/paynearme-devdocs/reference/post_make-payment)
request, use the following parameters.
Parameter | Description | Type | Required? |
---|---|---|---|
payment_method_identifier | The unique identifier for this payment method. | string | R |
payment_amount | The decimal value of the payment amount. | dec | R |
payment_currency | USD | 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 callbacks, use the pnm_payment_identifier parameter rather than the site_payment_identifier . | string | O |
pricing_schedule_name | Specifies the name of the pricing schedule. Supported values include the following:
| enum | O |
site_channel | The payment channel where this payment method was created. Supported options include the following:
| enum | R |
notification_contact | The email or mobile number that PayNearMe will contact when payments are made with this payment method. | string | 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/make_payment' \
--data-raw '{
"payment_amount": "500.00",
"payment_currency": "USD",
"payment_method_identifier": "d041313f4c04c",
"signature": "5545f6150725bb6f0893fce6cecd25f7c4290d8ac431acba79fa27566a0efc75",
"site_channel": "agent ",
"site_identifier": "S2155373459",
"timestamp": "1668621441",
"version": "3.0",
"pnm_order_identifier": "81214331198",
"site_payment_identifier": "224466881010",
"pricing_schedule_name": "agent",
"notification_contact": "214-448-5393"
}'
{
"response_code": "0",
"status": "ok",
"payment": {
"payment_made": "2022-11-16 09:57:22 -0800",
"payment_amount": "504.99",
"payment_currency": "USD",
"payment_status": "approved",
"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"
}
}
}
}
After receiving the payment response, ensure that you record and store the pnm_payment_identifier
value (highlighted above). The pnm_payment_identifier
is the unique ID that PayNearMe assigns to that specific payment attempt. This parameter is required if you need to cancel or refund the payment in the future.
Updated about 1 year ago