Introduction

PayNearMe’s comprehensive, lightweight REST API library is an ideal solution for merchants and partners who want to leverage the PayNearMe platform while maintaining their own UI/UX and branding standards. Using standard HTTP protocols and architecture, PayNearMe’s REST API enables merchants to quickly create orders, create payment methods, make payments, or query for information.

PayNearMe's API currently supports over 35 endpoints whose actions range from order creation to payment method tokenization to payment and disbursement transaction management and consumer notifications. While every integration is different, most clients use the following calls to collect payments.

Payment collection can be as simple as two calls (e.g., /find_orders and /create_payment_method) or can be comprised of the five calls listed above. This all depends on how your business wants to structure the payment flow. Will the payment be collected at the same time the order is created or later in the billing cycle? Will you require payment method tokenization prior to payment (e.g., when the consumer is setting up an account in your application) or at the time of payment? Your PayNearMe Technical Account Manager can help you decide which calls are necessary for your specific payment integration. The following tutorial displays how to make a payment with a new payment method using two calls, /create_order and /create_payment_method.

The following sequence diagram shows a payment flow using the /find_order, /create_payment_method, and /make_payment API calls and shows how the requests interact with different systems in the PayNearMe platform. This diagram assumes the consumer's order was created prior to the request to make payment.

Make a Payment with a New Payment Method

sequenceDiagram
    participant ClientApp as Client App
    participant ClientCore as Client Core
    participant PNM as PayNearMe
    participant Issuer
    participant Processor

    ClientApp->>ClientCore: Request to Make Payment
    ClientCore->>PNM: API: /find_order
    PNM->>ClientCore: Return Order Details
    ClientCore->>ClientApp: Render Payment Form

    ClientApp->>ClientCore: Enter Payment Method Data
    ClientCore->>PNM: API: /create_payment_method
    PNM->>Issuer: AVS/CVV Check
    Issuer->>PNM: AVS Response
    PNM->>PNM: Created & Stored

    PNM->>ClientCore: Return Payment Method Token: payment_method_identifier
    ClientCore->>ClientCore: Created & Stored

    ClientApp->>ClientCore: Authorize Payment with New Payment Method
    ClientCore->>PNM: API: /make_payment
    PNM->>Processor: Payment Data Sent to Processor for Approval
    Processor->>PNM: Payment Response
    PNM->>PNM: Created & Stored

    PNM->>ClientCore: Return Payment Response
    ClientCore->>ClientApp: Render Receipt Text

    PNM->>ClientCore: Payment Confirmation Callback
    ClientCore->>PNM: Callback Response

With PayNearMe's tokenization solution, repeat payments can be as simple as two clicks for consumers in your application. Clients can opt to store the tokens (i.e., payment_method_identifier) or can perform a simple lookup to quickly populate payment methods that PayNearMe has already vetted and authorized. The following tutorial shows how to quickly make a payment with an existing payment method token with just two calls.

The following sequence diagram displays a payment flow using the /find_order, /find_payment_method, and /make_payment calls and how each call interacts in the PayNearMe platform. This diagram assumes the consumer's order and payment method was created prior to the request to make payment.

Make a Payment with an Existing Payment Method

sequenceDiagram
    participant ClientApp as Client App
    participant ClientCore as Client Core
    participant PNM as PayNearMe
    participant Processor

    ClientApp->>ClientCore: Request to Make Payment
    ClientCore->>PNM: API: /find_order
    PNM->>ClientCore: Return Order Details
    ClientCore->>ClientApp: Render Payment Form

    ClientApp->>ClientCore: Select Saved Payment Method
    ClientCore->>PNM: API: /find_payment_method
    PNM->>ClientCore: Return Payment Method Token: payment_method_identifier

    ClientApp->>ClientCore: Authorize Payment with Payment Method Token
    ClientCore->>PNM: API: /make_payment
    PNM->>Processor: Payment Data Sent to Processor for Approval
    Processor->>PNM: Payment Response
    PNM->>PNM: Created & Stored

    PNM->>ClientCore: Return Payment Response
    ClientCore->>ClientApp: Render Receipt Text

    PNM->>ClientCore: Payment Confirmation Callback
    ClientCore->>PNM: Callback Response