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 intent value of AUTHORIZE.
    • Only compatible with pay tokens generated by the PayPal v2 API

    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

    onComplete

    Asynchronously vends either an AuthorizationActionSuccess or an Error object.

  • 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 intent value of CAPTURE.
    • Only compatible with pay tokens generated by the PayPal v2 API

    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

    onComplete

    Asynchronously vends either a CaptureActionSuccess or an Error object.

  • Execute the billingToken to 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 billingToken in the ApprovalData.
    • Only compatible with billing token generated by the PayPal Billing Agreements v1 API

    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

    onComplete

    Asynchronously vends either a BillingActionData or an Error object.

  • Get the details for an Order previously approved by the buyer. This function makes REST request to the orders/v2 API 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 the orders/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

    onComplete

    Callback 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 v2 API.
    • Can only be applied to orders with the CREATED or APPROVED status. You cannot update an order with the COMPLETED status.
    • 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

    request

    The request(s) to update the order with.

    • Currently only supports the following:
      • shippingName - add, replace
      • shippingAddress - add, replace
      • shippingOptions - add, replace
      • amount - replace

    onComplete

    Closure invoked when the patch request has resolved. Asynchronously vends either a PatchActionSuccess or an Error object.