Constructor
new PayPal(options)
Parameters:
| Name | Type | Description |
|---|---|---|
options |
object | see paypal.create |
- Source:
Methods
teardown(callbackopt) → {void}
Cleanly tear down anything set up by create.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
callback |
callback |
<optional> |
Called once teardown is complete. No data is returned if teardown completes successfully. |
- Source:
tokenize(options, callback) → {PayPal~tokenizeReturn}
Launches the PayPal login flow and returns a nonce payload.
Parameters:
| Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | All tokenization options for the PayPal component. Properties
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
callback |
callback | The second argument, |
- Source:
Example
button.addEventListener('click', function () {
// Because PayPal tokenization opens a popup, this must be called
// as a result of a user action, such as a button click.
paypalInstance.tokenize({
flow: 'vault' // Required
// Any other tokenization options
}, function (tokenizeErr, payload) {
if (tokenizeErr) {
// Handle tokenization errors or premature flow closure
return;
}
// Submit payload.nonce to your server
});
});
Type Definitions
tokenizePayload :object
Properties:
| Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
nonce |
string | The payment method nonce. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type |
string | The payment method type, always |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
details |
object | Additional PayPal account details. Properties
|
- Source:
tokenizeReturn :object
Properties:
| Name | Type | Description |
|---|---|---|
close |
function | A handle to close the PayPal checkout flow. |
- Source: