Set up your server

DOCS

Last updated: Sept 23rd, 5:43pm

To integrate the PayPal iOS SDK, integrate both the client and the server with PayPal's Orders v2 API. Read this section to set up the server-side integration.

Know before you code

Step 1: Get a token

Get the OAuth 2.0 credentials, client_id and client_secret.

Get a server-side token

For server-side API calls, pass a server-side access token as the Authorization header. See Get started.

Get a client-side token

To authenticate the client SDK, provide a client-side token.

Pass your base64 encoded client_id in the Authorization header in a POST request to https://api-m.paypal.com/v1/oauth2/token.

Sample request

    1curl -v -k https://api-m.paypal.com/v1/oauth2/token \
    2
    3-H "Authorization: Basic ${BASE_64_ENCODED_CLIENT_ID}" \
    4-H "Content-Type: application/x-www-form-urlencoded" \
    5-d "grant_type=client_credentials" \
    6-d "response_type=id_token" \
    7-d "target_customer_id=${CUSTOMER_ID}" \
    8-d "entry_point=paypal_native_sdk"

    target_customer_id is an optional parameter, which has your unique identifier for the customer.

    Step result

    A successful response returns the id_token value.

    Sample response

      1{
      2 "scope": "SCOPE",
      3 "id_token": "ID_TOKEN",
      4 "token_type": "Bearer",
      5 "app_id": "APP-ID",
      6 "expires_in": 31945,
      7 "nonce": "NONCE"
      8}

      Step 2: Get an order ID

      An order represents a payment between two or more parties. Use the Orders v2 API to create an order and generate an order ID.

      Next Step

      Set up your iOS client