Paypal.Order (Paypal v0.1.1)

View Source

The orders is the element that let us to charge an amount to the clients.

We have to ways to proceed, it's called the intent and depending on what you choose, it will let you charge the money instantly or hold the money until the process, product or service will be released.

  • capture is the intent that charge the money immediately. The flow is:

    1. Crete the order using capture as the intent, see create/2.
    2. Use the URL inside of the response for approving the payment.
    3. Capture the money, see capture/1.
  • authorize is the intent that hold the money and it will let you capture the fonds later. The flow is:

    1. Create the order using authorize as the intent, see create/2.
    2. Use the URL inside of the response for approving the payment.
    3. Create the authorization, see authorize/1.
    4. Capture fonds using the authorization, see Paypal.Payment.capture/1.

If you are interested on the authorization, check Paypal.Payment module for further information.

Summary

Functions

The kind of intents, for further information Paypal.Order.

Statuses for the order. The order is following different states, we could illustrate it as a state diagram

Functions

authorize(id)

capture(id)

create(intent, purchase_units, experience_context)

@spec create(
  :capture | :authorize,
  [Paypal.Order.PurchaseUnit.t() | map()],
  Paypal.Order.ExperienceContext.t() | map()
) ::
  {:ok, Paypal.Order.Info.t()} | {:error, Paypal.Common.Error.t() | String.t()}

Create an order.

intents()

The kind of intents, for further information Paypal.Order.

show(id)

statuses()

Statuses for the order. The order is following different states, we could illustrate it as a state diagram:

stateDiagram-v2
    [*] --> CREATED
    CREATED --> PAYER_ACTION_REQUIRED
    PAYER_ACTION_REQUIRED --> APPROVED
    APPROVED --> SAVED
    SAVED --> APPROVED
    APPROVED --> VOIDED
    APPROVED --> COMPLETED
    VOIDED --> [*]
    COMPLETED --> [*]

As you can see, we start in CREATED state and we are moving until reach VOIDED or COMPLETED.