<?php require_once __DIR__ . '/../../AvangateJsonrpcClient.php'; use AvangateJsonrpcClient as Client; /** * Initialize client */ Client::setBaseUrl('https://api.avangate.com/rpc/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,
<?php require_once __DIR__ . '/../../AvangateJsonrpcClient.php'; use AvangateJsonrpcClient as Client; /** * Initialize client */ Client::setBaseUrl('https://api.avangate.com/rpc/3.0/'); Client::setCredentials('APITEST', 'SECRET_KEY'); /** * Prepare call */ $AvangateCustomerReference = 435384557; $customerObject = Client::getCustomerInformation($AvangateCustomerReference); echo json_encode($customerObject, JSON_PRETTY_PRINT); // output: // { // "AvangateCustomerReference": "435384557", // "ExternalCustomerReference": null, // "FirstName": "John", // "LastName": "Jsonrpc", // "Company": "A", // "FiscalCode": "12345", // "Address1": "DP10A", // "Address2": "CBP, b3", // "City": "Atlanta", // "State": "Georgia", // "Zip": "123456", // "CountryCode": "us", // "Phone": "021-000-222", // "Fax": "021-000-000",
*/ Client::setBaseUrl('https://api.avangate.com/rpc/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
/** * Prepare call - get a non-empty product code */ $productListing = Client::searchProducts(['Limit' => 1, 'Enabled' => true, 'Types' => ['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 = ['Items' => [0 => ['Code' => $productCode, 'Quantity' => 1]], 'BillingDetails' => ['FirstName' => 'John', 'LastName' => 'Doe', 'Email' => '*****@*****.**', 'CountryCode' => 'RO'], 'PaymentDetails' => ['Type' => 'CC', 'Currency' => 'EUR', 'PaymentMethod' => ['CardType' => 'visa', 'CardNumber' => '4111111111111111', 'CCID' => '123', 'ExpirationMonth' => '10', 'ExpirationYear' => '2020', 'HolderName' => 'John Doe']]]; $responsePlaceOrder = Client::placeOrder($order); echo json_encode($responsePlaceOrder, 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,
* Initialize client */ Client::setBaseUrl('https://api.avangate.com/rpc/3.0/'); Client::setCredentials('APITEST', 'SECRET_KEY'); /** * Prepare call */ $productData = ['ProductCode' => 'PRODUCT_TEST_' . uniqid(), 'ProductType' => 'REGULAR', 'ProductName' => 'AV | Team', 'ProductVersion' => '', 'GroupName' => 'General', 'ShippingClass' => null, 'GiftOption' => false, 'ShortDescription' => '', 'LongDescription' => '', 'SystemRequirements' => '', 'ProductCategory' => false, 'Platforms' => [], 'ProductImages' => [], 'TrialUrl' => '', 'TrialDescription' => '', 'Enabled' => true, 'AdditionalFields' => [], 'Translations' => [], 'PricingConfigurations' => [['Name' => 'AV | Price Configuration', 'Code' => '54BCEB100D', 'Default' => true, 'BillingCountries' => [], 'PricingSchema' => 'DYNAMIC', 'PriceType' => 'NET', 'DefaultCurrency' => 'USD', 'Prices' => ['Regular' => [['Amount' => 39.99, 'Currency' => 'USD', 'MinQuantity' => '1', 'MaxQuantity' => '99999', 'OptionCodes' => []]], 'Renewal' => []], 'PriceOptions' => []]], 'Prices' => [], 'BundleProducts' => [], 'Fulfillment' => 'BY_VENDOR', 'GeneratesSubscription' => true, 'SubscriptionInformation' => ['DeprecatedProducts' => [], 'BundleRenewalManagement' => 'GLOBAL', 'BillingCycle' => '-1', 'BillingCycleUnits' => 'M', 'IsOneTimeFee' => true, 'ContractPeriod' => null, 'UsageBilling' => 0, 'GracePeriod' => null, 'RenewalEmails' => ['Type' => 'GLOBAL', 'Settings' => ['ManualRenewal' => ['Before30Days' => false, 'Before15Days' => false, 'Before7Days' => true, 'Before1Day' => false, 'OnExpirationDate' => false, 'After5Days' => false, 'After15Days' => false], 'AutomaticRenewal' => ['Before30Days' => false, 'Before15Days' => false, 'Before7Days' => true, 'Before1Day' => false, 'OnExpirationDate' => false, 'After5Days' => false, 'After15Days' => false]]]], 'FulfillmentInformation' => ['IsStartAfterFulfillment' => false, 'IsElectronicCode' => false, 'IsDownloadLink' => false, 'IsBackupMedia' => false, 'IsDownloadInsuranceService' => false, 'IsInstantDeliveryThankYouPage' => true, 'IsDisplayInPartnersCPanel' => false, 'CodeList' => null, 'BackupMedia' => null, 'ProductFile' => null, 'AdditionalInformationByEmail' => 'install instructions', 'AdditionalInformationEmailTranslations' => [['Name' => null, 'Description' => 'install instructions french', 'Language' => 'FR'], ['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__ . '/../../AvangateJsonrpcClient.php'; use AvangateJsonrpcClient as Client; /** * Initialize client */ Client::setBaseUrl('https://api.avangate.com/rpc/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": {