ApprovalActions
@objc(PPCApprovalActions)
@objcMembers
class ApprovalActions
extension ApprovalActions : CVarArg, CustomDebugStringConvertible, CustomStringConvertible, Equatable, Hashable, NSObjectProtocol
Provides an interface to make common order requests from within the PayPal Checkout SDK.
-
Makes a request to the PayPal API to authorize the approved payment.
Uses the approval data to
- Generate a low scoped access token
- Upgrade the access token in order to authorize the payment
- Make a request to authorize the payment
More information can be found in the API documentation: Authorization Documentation
Note
- Should only be invoked on transactions with an
intentvalue ofAUTHORIZE. - Only compatible with pay tokens generated by the PayPal
v2API
Declaration
Swift
@available(*, deprecated, message: " This function will be removed in a future version. Calling this client side function will continue to work as expected, however we will soon only support server side integrations. ") func authorize(onComplete: @escaping (AuthorizeActionSuccess?, Error?) -> Void)Parameters
onCompleteAsynchronously vends either an
AuthorizationActionSuccessor anErrorobject. -
Makes a request to the PayPal API to capture the approved payment.
Uses the approval data to
- Generate a low scoped access token
- Upgrade the access token in order to capture the payment
- Make a request to capture the approved payment
More information can be found in the API documentation: Capture Documentation
Note
- Should only be invoked on transactions with an
intentvalue ofCAPTURE. - Only compatible with pay tokens generated by the PayPal
v2API
Declaration
Swift
@available(*, deprecated, message: " This function will be removed in a future version. Calling this client side function will continue to work as expected, however we will soon only support server side integrations. ") func capture(onComplete: @escaping (CaptureActionSuccess?, Error?) -> Void)Parameters
onCompleteAsynchronously vends either a
CaptureActionSuccessor anErrorobject. -
Execute the
billingTokento create a billing agreement and get a Billing-ID to be used for subsequent transactions.Uses the approval data to
- Generate a low scoped access token
Make a request to execute the billing agreement to obtain a Billing-ID
Note
Note:
- Should only be invoked on billing agreement transactions with a
billingTokenin theApprovalData. - Only compatible with billing token generated by the PayPal Billing Agreements
v1API
Declaration
Swift
@available(*, deprecated, message: " This function will be removed in a future version. Calling this client side function will continue to work as expected, however we will soon only support server side integrations. ") func executeBillingAgreement(onComplete: @escaping (BillingActionData?, Error?) -> Void)Parameters
onCompleteAsynchronously vends either a
BillingActionDataor anErrorobject. -
Get the details for an Order previously approved by the buyer. This function makes REST request to the
orders/v2API to retrieve the order details.For more information on the data returned from the Orders API, see https://developer.paypal.com/docs/api/orders/v2/#orders_get
Note
Getting order details is only supported for tokens generated using theorders/v2/API.Tokens generated using other endpoints (for example, billing agreements, or the
payments/v1/, will not be compatible with this function.Declaration
Swift
@available(*, deprecated, message: " This function will be removed in a future version. Calling this client side function will continue to work as expected, however we will soon only support server side integrations. ") func getOrderDetails(onComplete: @escaping (OrderDetails?, Error?) -> Void)Parameters
onCompleteCallback for when the order details have been fetched or an error is encountered.
-
Makes a request to the PayPal API to update an order.
Note
- Only compatible with pay tokens generated by the PayPal
v2API. - Can only be applied to orders with the
CREATEDorAPPROVEDstatus. You cannot update an order with theCOMPLETEDstatus. - You will need to handle any errors vended on the order request as part of the patch function.
Declaration
Swift
@available(*, deprecated, message: " This function will be removed in a future version. Calling this client side function will continue to work as expected, however we will soon only support server side integrations. ") func patch(request: PatchRequest, onComplete: @escaping (PatchActionSuccess?, Error?) -> Void)Parameters
requestThe request(s) to update the order with.
- Currently only supports the following:
shippingName- add, replaceshippingAddress- add, replaceshippingOptions- add, replaceamount- replace
onCompleteClosure invoked when the patch request has resolved. Asynchronously vends either a
PatchActionSuccessor anErrorobject. - Only compatible with pay tokens generated by the PayPal
View on GitHub
Install in Dash
ApprovalActions Class Reference