Manage PayPal QRC payments
The following describes how to manage payment operations using PayPal QRC.
Initialising the SDK for QRC
To start supporting PayPal QRC payments, you need to enable the payment method after initialising the SDK. See Initialisation.
1[[iZettleSDK shared] setEnabledAlternativePaymentMethod:@[@(IZSDKAlternativePaymentMethodPayPalQRC)]];
1let enabledAPMs = [NSNumber(value: IZSDKAlternativePaymentMethod.payPalQRC.rawValue)]2iZettleSDK.shared().setEnabledAlternativePaymentMethods(enabledAPMs)
When using PayPal QRC payments, merchants located in the US can chose to use either PayPal or Venmo when scanning QR codes.
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.
1- (void)chargePayPalQRCWithAmount:(NSDecimalNumber *)amount2reference:(NSString *)reference3appearance:(IZSDKPayPalQRCAppearance)appearance4presentedFromViewController:(UIViewController *)viewController5completion:(IZSDKPayPalQRCCompletion)completion
1func chargePayPalQRC(amount: NSDecimalNumber,2reference: String,3appearance: IZSDKPayPalQRCAppearance,4presentFrom viewController: UIViewController,5completion: IZSDKPayPalQRCCompletion)
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.
Note: When using PayPal QRC payments, merchants located in the US will have an option to start the payment using PayPal or Venmo UI appearances. This is because consumers can scan the QR code using either the Venmo or PayPal applications. In the payment result, you can extract which payment method was used by the consumer.
Refund an amount from a PayPal QRC payment with a given reference.
1- (void)refundPayPalQRCAmount:(nullable NSDecimalNumber *)amount2ofPaymentWithReference:(NSString *)paymentReference3refundReference:(NSString *)refundReference4presentFromViewController:(UIViewController *)viewController5completion:(IZSDKPayPalQRCCompletion)completion
1func refundPayPalQRC(amount: NSDecimalNumber?,2ofPayment paymentReference: String,3withRefundReference refundReference: String,4presentFrom viewController: UIViewController,5completion: IZSDKPayPalQRCCompletion)
amount(optional): The amount to be refunded from the payment (passing
nilwill 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.
Retrieving payment info
Query the Zettle SDK for payment information for a PayPal QRC payment with a given reference.
1- (void)retrievePayPalQRCPaymentInfoForReference:(NSString *)reference2presentFromViewController:(UIViewController *)viewController3completion:(IZSDKPayPalQRCCompletion)completion
1func retrievePayPalQRCPaymentInfo(for reference: String,2presentFrom viewController: UIViewController,3completion: IZSDKPayPalQRCCompletion)
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.
|Total transaction amount|
|Which QRC type was used to perform the payment PayPal or Venmo (USA Only)|
|Zettle's reference to the payment (not to be confused with the reference provided by you during a charge or refund operation)|
|Transaction Identifier that should be displayed on receipts|
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".
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.
|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|