PayPal configure()

configure()

Configuration method for initializing the SDK.

This method should be called only once for the page load. After calling this method, the SDK will provide configuration values as member variables.

If not provided, apiVersion is defaulted to 60.


Usage Copied to clipboard

GatewayPaypal.configure(config, errorCallback, completeCallback, cancelCallback);


Example Copied to clipboard

function errorCallback(error) {
};

function completeCallback(response) { };
function cancelCallback(response) { };
GatewayPaypal.configure({ merchantId: "TESTMERCHANT", sessionId: "SESSION0002899787259G30902270H6", orderId: "1234567890", transactionId: "Trans12345", currency: "USD", paymentConfirmation: "CONFIRM_AT_PROVIDER", operation: "PAY", apiVersion: 60, buttonElement: "PayPalButton", style: { color: 'blue', shape: 'rect', label: 'paypal', tagline: 'true' } }, errorCallback, completeCallback, cancelCallback );

Arguments Copied to clipboard

GatewaypaypalConfig Copied to clipboard Object REQUIRED

Configuration values.

merchantId Copied to clipboard String REQUIRED

The unique identifier issued to you by your payment provider.

sessionId Copied to clipboard String REQUIRED

The identifier of the payment session.

orderId Copied to clipboard String REQUIRED

A unique identifier for this order to distinguish it from any other order you create.

transactionId Copied to clipboard String REQUIRED

Unique identifier for this transaction to distinguish it from any other transaction on the order.

currency Copied to clipboard String REQUIRED

The currency of the order expressed as an ISO 4217 alpha code, e.g. USD.

paymentConfirmation Copied to clipboard String

Indicates where in the checkout flow you want the payer to commit to the payment.

CONFIRM_AT_PROVIDERSet this if you want the payer to commit to the payment on the PayPal website.
CONFIRM_AT_MERCHANTSet this if you want the payer to commit to the payment on your website.
operation Copied to clipboard String REQUIRED

The type of transaction you want to create for this payment. You can choose between an Authorization and a Payment transaction.

For a successful Authorization transaction, you must submit a CAPTURE request to move the funds from the payer's account to your account.
AUTHORIZEThe transaction created in the gateway is an AUTHORIZATION transaction.
PAYThe transaction created in the gateway is a PAYMENT transaction.
apiVersion Copied to clipboard Number

The API version that you used when submitting the API CREATE_SESSION and UPDATE_SESSION requests.

You must use version 60 or above.

If not provided, the value is defaulted to 60.

buttonElement Copied to clipboard String REQUIRED

Identifier of the DOM element where the button will be rendered.

style Copied to clipboard Object

Style options for customizing the PayPal Smart Button.

color Copied to clipboard String

Color options for the PayPal Smart Button. One of "gold" (Recommended by PayPal), "blue", "silver", "white", "black".

If not provided, the value is defaulted to "gold".

shape Copied to clipboard String

Shape options for the PayPal Smart Button. One of "rect" (Default), "pill".

If not provided, the value is defaulted to "rect".

size Copied to clipboard Number

Size of the PayPal Smart Button. If not provided, the value is defaulted to the size of its container element.

To customize the button width, alter the width of the container element.

To customize the button height, set the height option to a value from 25 to 55.

label Copied to clipboard String

Label options for the button. One of "paypal" (Default), "checkout", "buynow", "pay".

If not provided, the value is defaulted to "paypal".

tagline Copied to clipboard String

Option to display tagline. One of "true" (Default), "false".

If not provided, the value is defaulted to "true".

errorCallback Copied to clipboard Object REQUIRED
error Copied to clipboard Object
message Copied to clipboard String

Error message received from either Gateway or PayPal.

response Copied to clipboard Object

Error response received from either Gateway or PayPal.

completeCallback Copied to clipboard Object REQUIRED
response Copied to clipboard Object

Response after successful completion of the payment. The response will be same as that of CONFIRM_BROWSER_PAYMENT or UPDATE_BROWSER_PAYMENT operation.

cancelCallback Copied to clipboard Object REQUIRED
response Copied to clipboard Object

Response after cancellation of the payment.


Return Value Copied to clipboard

None