Creates a PayPal Pay Later one-time payment session for buy now, pay later transactions.
Configuration options for the Pay Later payment session
A session object that can be used to start the Pay Later flow
Creates a PayPal Credit one-time payment session for credit-based transactions.
Configuration options for the PayPal Credit payment session
A session object that can be used to start the PayPal Credit flow
This method enables customers to make purchases using PayPal Credit, allowing them to pay over time with financing options. Available in supported countries.
const creditSession = sdkInstance.createPayPalCreditOneTimePaymentSession({
onApprove: (data) => {
console.log('PayPal Credit payment approved:', data);
},
onCancel: () => {
console.log('PayPal Credit payment canceled');
},
onError: (data) => {
console.error('PayPal Credit payment error:', data);
}
});
Creates a PayPal one-time payment session for processing single payments through PayPal.
Configuration options for the PayPal payment session
A session object that can be used to start the payment flow
This method allows you to configure callback functions to handle different stages of the PayPal checkout process, including payment approval, shipping address changes, shipping option changes, cancelation, and errors.
const paypalSession = sdkInstance.createPayPalOneTimePaymentSession({
onApprove: (data) => {
console.log('PayPal payment approved:', data);
},
onShippingAddressChange: (data) => {
console.log('Shipping address changed:', data);
},
onShippingOptionsChange: (data) => {
console.log('Shipping options changed:', data);
},
onCancel: () => {
console.log('PayPal payment canceled');
},
onError: (data) => {
console.error('PayPal payment error:', data);
}
});
Creates a PayPal save payment session for storing payment methods for future use.
Configuration options for the save payment session
A session object that can be used to start the vault setup flow
This method allows you to set up vault payment sessions where customers can save their PayPal payment method for future transactions without re-entering details.
const savePaymentSession = sdkInstance.createPayPalSavePaymentSession({
vaultSetupToken: 'your-vault-setup-token',
onApprove: (data) => {
console.log('Payment method saved:', data);
},
onCancel: () => {
console.log('Save payment canceled');
},
onError: (data) => {
console.error('Save payment error:', data);
}
});
PayPal Payments Instance interface for creating and managing different types of PayPal payment sessions.
Remarks
This interface provides methods to create various PayPal payment flows including:
Each method returns a payment session object that can be used to initiate the corresponding payment flow with different presentation modes (popup, modal, redirect, etc.).
Example