Skip to main content

Use Purchase order flow

Last updated: 14-Dec-2023
Rate this article:

Overview 

Place an order using catalog products, and collect the payment using the Purchase Order flow.

Requirements

You have to send the InternalPONumber and AutoApprove parameters to place a Purchase Order. The company name is mandatory when placing an order via PO.

Currency support 

Check with Avangate support for a list of currencies available for Purchase Order. 

Parameters 

Parameters Type/Description

sessionID

Required (string)

 

Session identifier, the output of the Login method. Include sessionID into all your requests. Avangate throws an exception if the values are incorrect.  The sessionID expires in 10 minutes.

Order

Required (Object)

 

Object designed to collect all data necessary for an order, including billing, product/subscription plan, and payment details.

 

Workflow 

  1. The customer is placing the order using Purchase Order as the ordering flow, filling in the internal PO number as mandatory information.
  2. You are able to set the order to auto-approve as soon as the purchase order is submitted. Otherwise, you have to approve/cancel it manually from Control Panel.
  3. After the order is placed, the order confirmation e-mail is sent, including the payment instructions and payment terms agreed.
  4. The order is finalized as soon as the payment is confirmed.
  5. If payment is not received according to the terms, the order is canceled.

Response 

Order information

Object

Request

<?php

require ('PATH_TO_AUTH');

$Order = new stdClass();
$Order->RefNo = NULL;
$Order->Currency = 'usd';
$Order->Country = 'US';
$Order->Language = 'en';
$Order->CustomerIP = '91.220.121.21';
$Order->ExternalReference = NULL;
$Order->Source = NULL;
$Order->Affiliate = new stdClass();
$Order->Affiliate->AffiliateCode = 'Partner123'
$Order->Affiliate->AffiliateSource = 'MobilePlatform'
$Order->CustomerReference = NULL;
$Order->Items = array();
$Order->Items[0] = new stdClass();
$Order->Items[0]->Code = 'my_subscription_1';
$Order->Items[0]->Quantity = 1;
$Order->Items[0]->PriceOptions = NULL;
$Order->Items[0]->SKU = NULL;
$Order->Items[0]->Price = NULL;
$Order->Items[0]->CrossSell = NULL;
$Order->Items[0]->Trial = false;
$Order->Items[0]->AdditionalFields = NULL;
$Order->Items[0]->SubscriptionStartDate = NULL; //If empty or null, subscriptions become active when purchase is made.
$Order->BillingDetails = new stdClass();
$Order->BillingDetails->FirstName = 'Test Cosmin API';
$Order->BillingDetails->LastName = 'Cosmin API';
$Order->BillingDetails->CountryCode = 'us';
$Order->BillingDetails->State = 'California';
$Order->BillingDetails->City = 'LA';
$Order->BillingDetails->Address1 = 'Address example';
$Order->BillingDetails->Address2 = NULL;
$Order->BillingDetails->Zip = '90210';
$Order->BillingDetails->Email = 'cosmin.deftu@avangate.com';
$Order->BillingDetails->Phone = NULL;
$Order->BillingDetails->Company = 'ABC Company';
$Order->DeliveryDetails = NULL;


$Order->PaymentDetails = new stdClass ();
$Order->PaymentDetails->Type = 'PURCHASEORDER';
$Order->PaymentDetails->Currency = 'USD';
$Order->PaymentDetails->PaymentMethod = new stdClass();
$Order->PaymentDetails->PaymentMethod->AutoApprove = true;
$Order->PaymentDetails->PaymentMethod->InternalPONumber = 84864848;

$Order->AdditionalFields = NULL;
$Order->LocalTime = NULL;
$Order->GiftDetails = NULL;

$jsonRpcRequest = array (
'method' => 'placeOrder',
'params' => array($sessionID, $Order),
'id' => $i++,
'jsonrpc' => '2.0'
);

$order = callRPC($jsonRpcRequest, $host);
Rate this article:

Need help?

Do you have a question? If you didn’t find the answer you are looking for in our documentation, you can contact our Support teams for more information. If you have a technical issue or question, please contact us. We are happy to help.

Not yet a Verifone customer?

We’ll help you choose the right payment solution for your business, wherever you want to sell, in-person or online. Our team of experts will happily discuss your needs.

Verifone logo