Paypal Checkout SDK
  • Introduction
  • Requirements
  • Installation
  • Upgrading
  • Questions and issues
  • Changelog
  • Basic Usage
    • Create an Order
    • Show an Order
    • Capture an Order
  • Api
    • Amount
    • Amount Breakdown
    • Application Context
    • Item
    • Order
    • Payee
    • Purchase Unit
Powered by GitBook
On this page
  • Methods
  • Order::__construct()
  • Order::addPurchaseUnit()
  • Order::getPurchaseUnits()
  • Order::setApplicationContext()
  • Order::getApplicationContext()
  • Order::setIntent()
  • Order::getIntent()
  • Order::getId()
  • Order::getStatus()
  • Order::getPayee()

Was this helpful?

Export as PDF
  1. Api

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;
PreviousItemNextPayee

Last updated 3 years ago

Was this helpful?