PayPal
With the PayPal integration, merchants can subscribe to the following events to get response or error objects from our Gateway.
Event | Description |
---|---|
fz.paypal.error | Emitted when there is any PayPal errors including: - Rendering the PayPal button - Validation errors (e.g. invalid request payload) - Any PayPal initiated errors |
fz.paypal.processing | Emitted when Fatzebra is processing the payment. This can be used to inform users, e.g. with a processing message |
fz.paypal.cancel | Emitted when user cancels a payment |
fz.paypal.success | Emitted when user confirms the payment/billing agreement |
Note
Event listeners should be set up before calling
fz.setupPayPal()
.
fz.paypal.error
{
data: null,
errors: ['Invalid request payload']
}
fz.paypal.processing
{
data: {},
message: 'The request is being processed.'
}
fz.paypal.cancel
{
data: {
orderID: '335GS56ADSG5'
},
message: 'PayPal Checkout cancelled.'
}
fz.paypal.success
This event is fired for a successful order or a billing agreement:
1. PayPal Order
{
message: 'PayPal order approved.'
data: {
id: "123-PPO-NJV6YOCZ60J8NISE",
reference: "ref_12345_281973",
amount: 12000,
decimalAmount: 120.0,
successful: true,
message: "Approved",
currency: "AUD",
transactionId: "123-PPO-NJV6YOCZ60J8NISE",
transactionDate: "2020-08-27T15:14:22+10:00",
intent: "Capture",
paypalReference: "ref_12345_281973",
invoiceId: "ref_12345_281973",
billingAgreementId: null,
status: "Completed",
paymentSource: null,
authorizedAmount: 0.0,
capturedAmount: 120.0,
refundedAmount: 0.0,
authorizations: [],
captures: [
{
id: "123-PPC-BHG8DOSWRCVLGZOK",
status: "Completed",
captured: true,
amount: 12000,
decimalAmount: 120.0,
successful: true,
currency: "AUD",
transactionId: "123-PPC-BHG8DOSWRCVLGZOK",
transactionDate: "2020-08-27T15:14:22+10:00",
invoiceId: "ref_12345_281973",
paypalFee: 318,
sellerReceivableNetAmount: 11682,
noteToPayer: "Sporting Goods",
isFinalCapture: true
}
],
refunds: [],
payer: {
id: "29E2S1DN8P7FY",
email: "[email protected]",
address: { countryCode: "AU" }
},
payee: {
id: "JEUIDZ5Q5JE0E",
email: "[email protected]"
}
}
}
2. PayPal Billing Agreement
{
message: 'PayPal Billing Agreement created.'
data: {
id: "123-PBA-OPFHG40FRT6AHDENC",
name: "Sample Billing Agreement",
description: "Stored PayPal account",
state: "Active",
payer: {
payerInfo: {
email: "[email protected]",
firstName: "Test Buyer",
lastName: "Buyer",
payerId: "4NGF92BA8UA5S"
}
},
shippingAddress: {
firstName: "John",
lastName: "Doe",
address_1: "100 Kent Street",
address_2: "Cafe Lane",
city: "Sydney",
state: "NSW",
postcode: "2000",
country: "AU"
},
merchantCustomData: "",
createdAt: "2020-08-27T15:15:13+10:00"
}
}
Updated almost 3 years ago