Order

See https://developer.paypal.com/docs/api/orders/v2/#definition-order.

Methods

Order::__construct()

Creates an order object using constructor.

Signature

public function __construct(string $intent = CAPTURE);

Example

$order = new Order('CAPTURE');

Order::addPurchaseUnit()

Adds a new purchase unit item into purchase_units array.

Signature

public function addPurchaseUnit(PurchaseUnit $purchase_unit): self;

Example

$order = new Order('CAPTURE');
$order->addPurchaseUnit($purchase_unit);

Order::getPurchaseUnits()

Gets an array for purchase units from an order.

Signature

public function getPurchaseUnits(): array;

Example

$purchase_units = $order->getPurchaseUnits($purchase_unit);

Order::setApplicationContext()

Sets the application context of an order.

Signature

public function setApplicationContext(ApplicationContext $application_context): self;

Example

$order = new Order('CAPTURE');
$order->setApplicationContext($application_context);

Order::getApplicationContext()

Gets an order application context.

Signature

public function getApplicationContext(): ?ApplicationContext;

Example

$application_context = $order->getApplicationContext() // ApplicationContext::class ;

Order::setIntent()

Sets an order intent.

Signature

public function setIntent(string $intent): self;

Example

$order = new Order('CAPTURE');
$order->setIntent('AUTHORIZE');

Order::getIntent()

Gets an order intent.

Signature

public function getIntent(): string;

Example

$order = new Order('CAPTURE');
$intent = $order->getIntent() // CAPTURE;

Order::getId()

Gets an order id.

Signature

public function getId(): string;

Example

$order = new Order('CAPTURE');
$id = $order->getId() // 8F783829JA718493L;

Order::getStatus()

Gets an order status.

Signature

public function getStatus(): string;

Example

$order = new Order('CAPTURE');
$status = $order->getStatus() // COMPLETED;

Order::getPayee()

Gets an order payee.

Signature

public function getPayee(): ?Payee;

Example

$order = new Order('CAPTURE');
$payee = $order->getPayee() // Payee::class;

Last updated