/** * Prepare call - get a non-empty product code */ $productListing = Client::searchProducts(array('Limit' => 1, 'Enabled' => true, 'Types' => array('REGULAR'))); if (empty($productListing)) { die('No enabled products were found.'); } $productCode = $productListing[0]->ProductCode; if (empty($productCode)) { die('Choose a product with a valid product code'); } /** * Prepare call - prepare order object */ $order = array('Items' => array(0 => array('Code' => $productCode, 'Quantity' => 1)), 'BillingDetails' => array('FirstName' => 'John', 'LastName' => 'Doe', 'Email' => '*****@*****.**', 'CountryCode' => 'RO'), 'PaymentDetails' => array('Type' => 'PAYPAL', 'Currency' => 'EUR', 'PaymentMethod' => array('Email' => '*****@*****.**', 'ReturnURL' => 'http://my.implementation.dev/callback/paypalreturn'))); $responsePlaceOrder = Client::placeOrder($order); echo json_encode($responsePlaceOrder, JSON_PRETTY_PRINT); // output: // { // "RefNo": "11299356", // "OrderNo": 0, // "ExternalReference": null, // "ShopperRefNo": null, // "Status": "PENDING", // "ApproveStatus": "WAITING", // "VendorApproveStatus": "OK", // "Language": "ro", // "OrderDate": "2015-11-18 16:49:52", // "FinishDate": null, // "Source": null, // "AffiliateSource": null,
* Initialize client */ Client::setBaseUrl('https://api.avangate.com/soap/3.0/'); Client::setCredentials('APITEST', 'SECRET_KEY'); /** * Prepare call */ $productData = array('ProductCode' => 'PRODUCT_TEST_' . uniqid(), 'ProductType' => 'REGULAR', 'ProductName' => 'AV | Team', 'ProductVersion' => '', 'GroupName' => 'General', 'ShippingClass' => null, 'GiftOption' => false, 'ShortDescription' => '', 'LongDescription' => '', 'SystemRequirements' => '', 'ProductCategory' => false, 'Platforms' => array(), 'ProductImages' => array(), 'TrialUrl' => '', 'TrialDescription' => '', 'Enabled' => true, 'AdditionalFields' => array(), 'Translations' => array(), 'PricingConfigurations' => array(array('Name' => 'AV | Price Configuration', 'Code' => '54BCEB100D', 'Default' => true, 'BillingCountries' => array(), 'PricingSchema' => 'DYNAMIC', 'PriceType' => 'NET', 'DefaultCurrency' => 'USD', 'Prices' => array('Regular' => array(array('Amount' => 39.99, 'Currency' => 'USD', 'MinQuantity' => '1', 'MaxQuantity' => '99999', 'OptionCodes' => array())), 'Renewal' => array()), 'PriceOptions' => array())), 'Prices' => array(), 'BundleProducts' => array(), 'Fulfillment' => 'BY_VENDOR', 'GeneratesSubscription' => true, 'SubscriptionInformation' => array('DeprecatedProducts' => array(), 'BundleRenewalManagement' => 'GLOBAL', 'BillingCycle' => '-1', 'BillingCycleUnits' => 'M', 'IsOneTimeFee' => true, 'ContractPeriod' => null, 'UsageBilling' => 0, 'GracePeriod' => null, 'RenewalEmails' => array('Type' => 'GLOBAL', 'Settings' => array('ManualRenewal' => array('Before30Days' => false, 'Before15Days' => false, 'Before7Days' => true, 'Before1Day' => false, 'OnExpirationDate' => false, 'After5Days' => false, 'After15Days' => false), 'AutomaticRenewal' => array('Before30Days' => false, 'Before15Days' => false, 'Before7Days' => true, 'Before1Day' => false, 'OnExpirationDate' => false, 'After5Days' => false, 'After15Days' => false)))), 'FulfillmentInformation' => array('IsStartAfterFulfillment' => false, 'IsElectronicCode' => false, 'IsDownloadLink' => false, 'IsBackupMedia' => false, 'IsDownloadInsuranceService' => false, 'IsInstantDeliveryThankYouPage' => true, 'IsDisplayInPartnersCPanel' => false, 'CodeList' => null, 'BackupMedia' => null, 'ProductFile' => null, 'AdditionalInformationByEmail' => 'install instructions', 'AdditionalInformationEmailTranslations' => array(array('Name' => null, 'Description' => 'install instructions french', 'Language' => 'FR'), array('Name' => null, 'Description' => 'install instructions japanese', 'Language' => 'JA')))); $responseAddProduct = Client::addProduct($productData); var_dump($responseAddProduct); // output: // bool(true) /** * Get added product details */ $productDetails = Client::getProductByCode($productData['ProductCode']); echo json_encode($productDetails, JSON_PRETTY_PRINT); // output: // { // "AvangateId": "4590126", // "ProductCode": "PRODUCT_TEST_564c9968d3d45", // "ProductType": "REGULAR", // "ProductName": "AV | Team", // "ProductVersion": "", // "GroupName": "General", // "ShippingClass": null, // "GiftOption": false, // "ShortDescription": "", // "LongDescription": "", // "SystemRequirements": "", // "ProductCategory": false,
<?php require_once __DIR__ . '/../../AvangateSoapClient.php'; use AvangateSoapClient as Client; /** * Initialize client */ Client::setBaseUrl('https://api.avangate.com/soap/3.0/'); Client::setCredentials('APITEST', 'SECRET_KEY'); /** * Get subscription details */ $subscriptionCode = "8AF9A9DC95"; $subscriptionDetails = Client::getSubscription($subscriptionCode); echo json_encode($subscriptionDetails, JSON_PRETTY_PRINT); // output: // { // "SubscriptionReference": "8AF9A9DC95", // "StartDate": "2015-01-01", // "ExpirationDate": "2020-01-01", // "RecurringEnabled": false, // "SubscriptionEnabled": true, // "Product": { // "ProductCode": "prod_many_options", // "ProductId": "4586004", // "ProductName": "APRODUCT", // "ProductVersion": "1", // "ProductQuantity": 1, // "PriceOptionCodes": null // }, // "EndUser": {
* Initialize client */ Client::setBaseUrl('https://api.avangate.com/soap/3.0/'); Client::setCredentials('APITEST', 'SECRET_KEY'); /** * Prepare call */ $customerObject = (object) array('FirstName' => 'John', 'LastName' => 'Jsonrpc', 'Email' => '*****@*****.**', 'Company' => 'A', 'FiscalCode' => '12345', 'Phone' => '021-000-222', 'Fax' => '021-000-000', 'Address1' => 'DP10A', 'Address2' => 'CBP, b3', 'Zip' => '123456', 'City' => 'Atlanta', 'State' => 'Georgia', 'CountryCode' => 'US', 'Language' => 'en'); $addedAvangateCustomerReference = Client::createCustomer($customerObject); echo 'Customer reference: ' . $addedAvangateCustomerReference . PHP_EOL; // output: // Customer reference: 141589723 /** * Get added details: */ $customerObject = Client::getCustomerInformation($addedAvangateCustomerReference); echo json_encode($customerObject, JSON_PRETTY_PRINT); // output: // { // "AvangateCustomerReference": "141589723", // "ExternalCustomerReference": null, // "FirstName": "John", // "LastName": "Jsonrpc", // "Company": "A", // "FiscalCode": "12345", // "Address1": "DP10A", // "Address2": "CBP, b3", // "City": "Atlanta", // "State": "Georgia", // "Zip": "123456", // "CountryCode": "us",
<?php require_once __DIR__ . '/../../AvangateSoapClient.php'; use AvangateSoapClient as Client; /** * Initialize client */ Client::setBaseUrl('https://api.avangate.com/soap/3.0/'); Client::setCredentials('APITEST', 'SECRET_KEY'); /** * Prepare call */ $refNo = '11331111'; $responseGetOrder = Client::getOrder($refNo); echo json_encode($responseGetOrder, JSON_PRETTY_PRINT); // output: // { // "RefNo": "11331111", // "OrderNo": 0, // "ExternalReference": null, // "ShopperRefNo": null, // "Status": "PENDING", // "ApproveStatus": "WAITING", // "VendorApproveStatus": "OK", // "Language": "ro", // "OrderDate": "2015-11-18 16:47:07", // "FinishDate": null, // "Source": null, // "AffiliateSource": null, // "AffiliateId": null, // "AffiliateName": null,
*/ Client::setBaseUrl('https://api.avangate.com/soap/3.0/'); Client::setCredentials('APITEST', 'SECRET_KEY'); /** * Prepare call */ $productId = 4586004; $subscriptionData = ['StartDate' => '2015-01-01', 'ExpirationDate' => '2020-01-01', 'LicenseHistory' => null, 'LicenseStatus' => 'ACTIVE', 'RecurringEnabled' => 'YES', 'EndUser' => ['FirstName' => 'John', 'LastName' => 'Doe', 'Company' => 'Company', 'Email' => '*****@*****.**', 'Phone' => '0123456789', 'Fax' => '9876543210', 'Address1' => 'address1', 'Address2' => 'address2', 'Zip' => '12345', 'City' => 'Bucharest', 'State' => 'State', 'CountryCode' => 'RO', 'Language' => 'ro'], 'ActivationInfo' => ['Codes' => ['Code' => mt_rand(100, 999), 'Description' => '-', 'File' => '', 'Extrainfo' => []], 'Description' => '-'], 'ExternalSubscriptionReference' => mt_rand(100, 999), 'Product' => ['ProductId' => $productId, 'ProductName' => 'APRODUCT', 'ProductCode' => '', 'ProductVersion' => '1', 'ProductQuantity' => 1, 'PriceOptionCodes' => []], 'NextRenewalPrice' => 100, 'NextRenewalPriceCurrency' => 'USD', 'CustomPriceBillingCyclesLeft' => 100]; $addedLicenseCode = Client::addSubscription($subscriptionData); var_dump($addedLicenseCode); // output: // string(10) "8AF9A9DC95" /** * Get subscription details */ $subscriptionDetails = Client::getSubscription($addedLicenseCode); echo json_encode($subscriptionDetails, JSON_PRETTY_PRINT); // output: // { // "SubscriptionReference": "8AF9A9DC95", // "StartDate": "2015-01-01", // "ExpirationDate": "2020-01-01", // "RecurringEnabled": false, // "SubscriptionEnabled": true, // "Product": { // "ProductCode": "prod_many_options", // "ProductId": "4586004", // "ProductName": "APRODUCT", // "ProductVersion": "1", // "ProductQuantity": 1, // "PriceOptionCodes": null