Manage PayPal QRC payments
The following describes how to manage payment operations using PayPal QRC. If you add PayPal QRC payments for your users in the US, you can provide them options to use either PayPal QRC or Venmo QRC when acquiring payments.
- The SDK initialisation is completed. See Initialisation.
- Presenting Settings view is completed. See Present Settings view.
To accept PayPal QRC payments with the SDK integration, enable the payment method after initialising the SDK.
When using PayPal QRC payments, merchants located in the US can choose to use either PayPal or Venmo when acquiring payments.
To initialise the SDK to use both PayPal and Venmo QRC types, you need to specify an NSNumber for the
setEnabledAlternativePaymentMethod
function. Passing in "0" enables both PayPal and Venmo QRC, since the Venmo QRC is a subtype of PayPal QRC.After the PayPal QRC payment method is enabled, a PayPal QRC screen will be added in the SDK Settings view. The screen is for your users to activate the payment method.
By default, if your integration is used in the UK or Germany, it's not activated for your integration users. Make sure that you remind them to activate PayPal QRC payment in the PayPal QRC screen before they use it.
The following example describes how to perform a payment with an amount and a reference.
amount
: The amount to be charged in the logged-in user's currency.reference
: Non-nullable payment reference. Used to identify a Zettle payment when retrieving payment information at a later time, or performing a refund. Max length 128.
Refund an amount from a PayPal QRC payment with a given reference.
amount
(optional): The amount to be refunded from the payment (passingnil
will refund the full amount of the original payment).paymentReference
: The reference of the payment that is to be refunded.refundReference
: The reference of the refund. Max length 128.
Query the Zettle SDK for payment information for a PayPal QRC payment with a given reference.
The completion callback will be called when an operation is completed, canceled, or failed.
Successful completion of the payment will provide
IZSDKPayPalQRCPaymentInfo
with the following details about the transaction.Name | Type | Description |
---|---|---|
amount | NSDecimalNumber | Total transaction amount |
type | IZSDKPayPalQRCType | Which QRC type was used to perform the payment PayPal or Venmo (USA Only) |
referenceNumber | NSString | Zettle's reference to the payment (not to be confused with the reference provided by you during a charge or refund operation) |
paypalTransactionId | NSString | Transaction Identifier that should be displayed on receipts |
transactionId | NSString | The ID for the transaction in the Zettle system. The ID is automatically generated by the Zettle system. |
The enumeration for the QRC type is in the completion object
IZSDKPayPalQRCType
. All enumerations must be backed up with the integers in Objective-C. This means the type you get back from the completion handler is not a standard string of "PayPal" or "Venmo". Therefore you need to implement logic that checks the QRC type and displays whether it was "PayPal" or "Venmo".When integrating with the SDK, you can test your integration in developer mode for PayPal QRC and Venmo QRC without a Zettle merchant account and real transactions.
- If developer mode is not enabled, enable it by calling the following function in your integration project:
- Launch the payment flow.
- Check the responses.The example shows test case "Successfully paid with PayPal".
- Launch the refund flow.
- Check the responses.The example shows test case "Successful PayPal refund".
Failure in completing a payment will generate an NSError. The error message describes the failure, and can contain any of the reasons listed in the following.
Name | Description |
---|---|
IZSDKPayPalQRCNetworkError | Network error |
IZSDKPayPalQRCLocationFailed | Unable to fetch user's location |
IZSDKPayPalQRCFeatureNotEnabled | Payment method is not available for the user |
IZSDKPayPalQRCOnboardingNotCompleted | Payment method activation is in progress |
IZSDKPayPalQRCSellerDataError | Something is wrong with the user's data |
IZSDKPayPalQRCPaymentCancelledByMerchant | Payment was canceled by the seller |
IZSDKPayPalQRCPaymentCancelledByBuyer | Payment was canceled by the buyer |
IZSDKPayPalQRCPaymentTimeout | Payment session has timed out |
IZSDKPayPalQRCNotAuthorized | User is not authorised for this action |
IZSDKPayPalQRCNotFound | No payment could be found for this reference |
IZSDKPayPalQRCRetrievalCancelled | Payment info retrieval has been canceled by the seller |
IZSDKPayPalQRCRefundAmountTooHigh | Requested amount couldn't be refunded for the payment |
IZSDKPayPalQRCRefundInsufficientFunds | There are not enough funds to perform refund in the seller's account |
IZSDKPayPalQRCRefundFailed | Payment is not refundable |
IZSDKPayPalQRCRefundCancelled | Payment refund has been canceled by the seller |
IZSDKPayPalQRCInvalidAmount | Provided amount is invalid |
IZSDKPayPalQRCAmountBelowMinimum | Provided amount is below the minimum amount |
IZSDKPayPalQRCAmountAboveMaximum | Provided amount is above the maximum amount |
IZSDKPayPalQRCTechnicalError | Unexpected technical error |