PayPal Payments Standard and Button Manager: Getting Started

API

Last updated: Sept 19th, 1:47am

Get up and running with this service:

Overview

PayPal Payments Standard is the simplest of the PayPal payment services: it helps you add a no-frills payment button, donation button, and so on to a web page. The person who clicks the payment button is redirected from the merchant site to PayPal and then back to the merchant site.

Key concepts

This guide is about the Button Manager API of PayPal Payments Standard.

To have more control over the button and its behavior, merchants should consider the PayPal REST API or one of the NVP/SOAP PayPal payment API solutions.

This guide does not explain how to create buttons manually. This brief summary describes the options for creating a button without the API:

  • Create an HTML form from scratch. To understand which variables control the button per your needs, see HTML Form Basics for PayPal Payments Standard.
  • Visit the PayPal site and confirm that you are ready to accept payments. Select the button type that you like, provide various facts about your site and the item or service you are selling, and PayPal generates HTML code for you. Then, copy this HTML code and embed it in your web page where you want the PayPal button to appear.

You can make calls in these formats:

Request method Request format Response format
HTTP POST Name/value pairs Name/value pairs
HTTP POST SOAP (1.1, 1.2) SOAP

Make your first call

The following example calls BMCreateButton in the Sandbox to create an button through the specified app (signified by combo of USER, PWD, SIGNATURE). The button is associated with details stored at PayPal.com regarding the item for sale.

  1. Obtain the endpoint for the service and environment you are addressing. The example below uses the Sandbox endpoint for a name-value pair format by using a Signature authentication:

      1https://api-3t.sandbox.paypal.com/nvp

      For the list of endpoints including the SOAP endpoints, see NVP/SOAP API endpoints.

    1. Provide the authentication. For the following sample call, set authentication credentials through the parameters that you pass to the call.

        1// Sandbox API credentials for the API Caller account
        2USER : // user id
        3PWD : // password
        4SIGNATURE : // signature
        5VERSION : // the release version of the API
      1. Provide parameters needed by the specific call being made. For this example, see also the BMCreateButton (SOAP) reference.

          1METHOD : BMCreateButton BUTTONCODE : HOSTED BUTTONTYPE : CART BUTTONSUBTYPE : PRODUCTS BUTTONCOUNTRY : US L_BUTTONVAR1 : item_name%3Dshoehorn L_BUTTONVAR2 : amount%3D1464.46 L_BUTTONVAR3 : tax=%3D21 L_BUTTONVAR4 : item_number%3D123456

          You can now make a call.

        1. Make the call. For an example, see Try It.

        2. Evaluate the response.

          For the following Try It example, you might get something like the following, which has been split to multiple lines for readability:

            1ACK=Success
            2// a URL-encoded HTML form that you could embed in a web page
            3&WEBSITECODE=%3cform%20target%3d%22paypal%22%20action%3d%22
            4https%3a%2f%2fwww%2esandbox%2epaypal%2ecom%3d%22 ...
            5// a URL you could include in an email (or any document supporting external links)
            6&EMAILLINK=https%3a%2f%2fwww%2esandbox%2epaypal%2ecom%2fcgi%2dbin%2fwebscr ...
            7// the ID of the PayPal-hosted button (with its information about the item available for purchase)
            8&HOSTEDBUTTONID=3PGCSXEGMJZJY
            9// additional artifacts of a job run
            10&TIMESTAMP=2011%2d08%2d11T07%3a40%3a46Z&CORRELATIONID=53ed2d7aea58a&VERSION=51%2e0&BUILD=2020243

            And, to make it readable for your insight, let's URL-decode bits of it.

              1WEBSITECODE=<form target="paypal" action="https://www.sandbox.paypal.com" ...
              2&EMAILLINK=https://www.sandbox.paypal.com/cgi-bin/webscr...

            Try it

            1. Copy this cURL command:

                1curl https://api-3t.sandbox.paypal.com/nvp \
                2 -s \
                3 --insecure \
                4 -d USER=platfo_1255077030_biz_api1.gmail.com \
                5 -d PWD=1255077037 \
                6 -d SIGNATURE=Abg0gYcQyxQvnf2HDJkKtA-p6pqhA1k-KTYE0Gcy1diujFio4io5Vqjf \
                7 -d VERSION=51.0 \
                8 -d METHOD=BMCreateButton \
                9 -d BUTTONCODE=HOSTED \
                10 -d BUTTONTYPE=CART \
                11 -d BUTTONSUBTYPE=PRODUCTS \
                12 -d BUTTONCOUNTRY=US \
                13 -d L_BUTTONVAR1=item_name%3Dshoehorn \
                14 -d L_BUTTONVAR2=amount%3D1464.46 \
                15 -d L_BUTTONVAR3=tax=%3D21 \
                16 -d L_BUTTONVAR4=item_number%3D123456
              1. Run the cURL command. If necessary, download the free cURL executable.

              Next steps

              To confirm that you set up your sandbox accounts correctly, try the same example with your own credentials:

              1. Set up your sandbox environment.

                To make test calls, you need a Sandbox account, test users, and PayPal API credentials. If you have not yet set these up, see PayPal sandbox Testing Guide.

              2. Substitute your own Sandbox credentials and user-specific inputs in the Try It example and rerun it to confirm that you set up your Sandbox and users correctly.

              References

              Schemas

              If you accept cookies, we’ll use them to improve and customize your experience and enable our partners to show you personalized PayPal ads when you visit other sites. Manage cookies and learn more