APM Prerequisites

Processing an APM payment requires a synchronization between your backend, from which the resources will be created securely, and the frontend, where your customers will pay.

Below is a sequence diagram that shows the flow for an APM that redirect a customer to a page hosted by the provider:

Creating the resources from your backend to start a payment

As usual, you must create an invoice as the first step in receiving the payment. The main difference with an APM-compatible invoice is the return_url field.

For mobile apps, this should be a deep link for the screen you want to return to after the APM payment page closes. You must provide the return_url to enable ProcessOut to pass control back to your app.

For in-browser payments, the return_url is optional. ProcessOut.js will trigger an event once the customer has returned from the APM flow.

📘

Note

Some browsers such as Samsung Internet Browser and Facebook iOS browsers (e.g. Messenger and Instagram) do not support redirection back to your web page after payment with an APM.

The code sample below shows how to create the Invoice with a return_url. See the page about setting up your environment to learn how to install the ProcessOut SDK for your language and access it using the client object.

curl https://api.processout.com/invoices \
    -u test-proj_gAO1Uu0ysZJvDuUpOGPkUBeE3pGalk3x:key_sandbox_mah31RDFqcDxmaS7MvhDbJfDJvjtsFTB \
    -d name="Amazing item" \
    -d amount="9.99" \
    -d currency=USD \
    -d return_url="https://www.super-merchant.com/return" \
    # Or, if you're integrating with a deep link on mobile:
    -d return_url="your.application.id://processout/return"
client.newInvoice().create({
    name:       "Amazing item",
    amount:     "4.99",
    currency:   "USD",
    return_url: "https://www.super-merchant.com/return",
    // Or, if you're integrating with a deep link on mobile:
    return_url: "your.application.id://processout/return"
}).then(function(invoice) {
    //

}, function(err) {
    // An error occurred
});
invoice = client.new_invoice().create({
    "name":       "Amazing item",
    "amount":     "4.99",
    "currency":   "USD",
    "return_url": "https://www.super-merchant.com/return",
    # Or, if you're integrating with a deep link on mobile:
    "return_url": "your.application.id://processout/return"
})
invoice = client.invoice.create(
    name:       "Amazing item",
    amount:     "4.99",
    currency:   "USD",
    return_url: "https://www.super-merchant.com/return",
    # Or, if you're integrating with a deep link on mobile:
    return_url: "your.application.id://processout/return"
)
$invoice = $client->newInvoice()->create(array(
    "name"       => "Amazing item",
    "amount"     => "4.99",
    "currency"   => "USD",
    "return_url" => "https://www.super-merchant.com/return",
    // Or, if you're integrating with a deep link on mobile:
    "return_url" => "your.application.id://processout/return",
));
iv, err := client.NewInvoice().Create(processout.InvoiceCreateParameters{
    Invoice: &processout.Invoice{
        Name:      processout.String("Amazing item"),
        Amount:    processout.String("4.99"),
        Currency:  processout.String("USD"),
        ReturnURL: processout.String("https://www.super-merchant.com/return"),
        // Or, if you're integrating with a deep link on mobile:
        ReturnURL: processout.String("your.application.id://processout/return"),
    },
})
if err != nil {
    panic(err)
}