Skip to content

DigitalRiver/digital-river-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Digitalriver APIs Client Library for PHP

Use this SDK to integrate Digital River API into your commerce app.

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: 2023
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen

Requirements

PHP 7.2 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/digitalriver/digital-river-php.git"
    }
  ],
  "require": {
    "digitalriver/digital-river-php": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/Digitalriver APIs Client Library for PHP/vendor/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure Bearer authorization: bearerAuth
// The following example will create a checkout. Replace YOUR_ACCESS_TOKEN with your confidential API key.
$config = DigitalRiver\ApiSdk\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$config->setHost('https://api.digitalriver.com');

$apiInstance = new DigitalRiver\ApiSdk\Api\CheckoutsApi(
  // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
  // This is optional, `GuzzleHttp\Client` will be used as default.
  new GuzzleHttp\Client(),
  $config
  );
  
  $checkout_request = new \DigitalRiver\ApiSdk\Model\CheckoutRequest(); // \DigitalRiver\ApiSdk\Model\CheckoutRequest |
  // Refer \DigitalRiver\ApiSdk\Model\CheckoutRequest::$setters in digital-river-php/lib/Model/CheckoutRequest.php to set the properties.

  $checkout_request->setCurrency('USD');
  $checkout_request->setLocale('en_US');
  $checkout_request->setEmail('anyemail@anydomain.com');
  
  $ship_from_address = new DigitalRiver\ApiSdk\Model\Address();
  $ship_from_address->setLine1('10380 Bren Road West');
  $ship_from_address->setLine2('');
  $ship_from_address->setCity('Minneapolis');
  $ship_from_address->setPostalCode('55343');
  $ship_from_address->setState('MN');
  $ship_from_address->setCountry('US');
  $ship_from = new DigitalRiver\ApiSdk\Model\ShipFrom();
  $ship_from->setAddress($ship_from_address);
  $checkout_request->setShipFrom($ship_from);

  $ship_to_address = new DigitalRiver\ApiSdk\Model\Address();
  $ship_to_address->setLine1('123 Sesame Street');
  $ship_to_address->setLine2('Suite 1a');
  $ship_to_address->setCity('Minneapolis');
  $ship_to_address->setPostalCode('55123');
  $ship_to_address->setState('MN');
  $ship_to_address->setCountry('US');

  $ship_to =  new DigitalRiver\ApiSdk\Model\Shipping();
  $ship_to->setAddress($ship_to_address);
  $ship_to->setName('John Doe');
  $ship_to->setPhone('612-343-4567');
  $ship_to->setEmail('anyemail@anydomain.com');
  $ship_to->setOrganization('Company Name (optional)');
  $checkout_request->setShipTo($ship_to);

  $shipping_choice = new DigitalRiver\ApiSdk\Model\ShippingRequest();
  $shipping_choice->setAmount(5.5);
  $shipping_choice->setDescription("Client provides-Standard Ground - US");
  $shipping_choice->setServiceLevel("Client provides shipping service");
  $checkout_request->setShippingChoice($shipping_choice);
  
  $item_1 = new DigitalRiver\ApiSdk\Model\SkuRequestItem();
  $item_1->setSkuId('365647477-5334d-9f4h-l15mq-45807987');
  $item_1->setQuantity(1);
  $item_1->setPrice(34.99);
  
  $item_2 = new DigitalRiver\ApiSdk\Model\SkuRequestItem();
  $item_2->setSkuId('06999045-5334d-9f4h-h56879k-45801126787');
  $item_2->setQuantity(1);
  $item_2->setPrice(20);
  
  $item_3 = new DigitalRiver\ApiSdk\Model\SkuRequestItem();
  $item_3->setSkuId('374687939-828d88-9f4h-h56879k-47908980498');
  $item_3->setQuantity(1);
  $item_3->setPrice(15);
  $checkout_request->setItems($item_1,$item_2,$item_3);

try {
  $result = $apiInstance->createCheckouts($checkout_request);
    print_r($result);
  } catch (Exception $e) {
    echo 'Exception when calling CheckoutsApi->createCheckouts: ', $e->getMessage(), PHP_EOL;
  }
?>

Documentation for API Endpoints

All URIs are relative to https://api.digitalriver.com

Class Method HTTP request Description
ChargesApi retrieveCharges GET /charges/{id} Gets a charge by ID
CheckoutsApi attachSourceToCheckout POST /checkouts/{id}/sources/{sourceId} Attach source to checkout.
CheckoutsApi createCheckouts POST /checkouts Creates a new checkout
CheckoutsApi deleteCheckouts DELETE /checkouts/{id} Deletes a checkout by ID.
CheckoutsApi detachSourceToCheckout DELETE /checkouts/{id}/sources/{sourceId} Deletes a checkout association to source.
CheckoutsApi listCheckouts GET /checkouts Returns a list of checkouts
CheckoutsApi retrieveCheckouts GET /checkouts/{id} Gets a checkout by ID.
CheckoutsApi updateCheckouts POST /checkouts/{id} Updates an existing checkout
CountrySpecificationsApi listCountrySpecifications GET /country-specs Returns an array containing a country specification
CustomersApi createCustomerSource POST /customers/{id}/sources/{sourceId} Attaches a source to a customer
CustomersApi createCustomerTaxIdentifier POST /customers/{id}/tax-identifiers/{taxId} Attaches a tax identifier to a customer
CustomersApi createCustomers POST /customers Creates a new customer
CustomersApi deleteCustomerSource DELETE /customers/{id}/sources/{sourceId} Detaches a source from a customer
CustomersApi deleteCustomers DELETE /customers/{id} Deletes a customer by ID
CustomersApi listCustomers GET /customers Returns a list of customers
CustomersApi retrieveCustomers GET /customers/{id} Gets a customer by ID
CustomersApi updateCustomers POST /customers/{id} Updates an existing customer
DropInCheckoutLinksApi createDropInCheckoutLink POST /drop-in/checkout-links Creates a new Drop-in checkout link
DropInCheckoutLinksApi deleteDropInCheckoutLinks DELETE /drop-in/checkout-links/{id} Deletes a Drop-in checkout link by ID.
DropInCheckoutLinksApi listDropInCheckoutLink GET /drop-in/checkout-links List Drop-in checkout links
DropInCheckoutSessionsApi createDropInCheckoutSession POST /drop-in/checkout-sessions Creates a new Drop-in checkout session
DropInShippingQuotesApi listShippingMethodQuotes POST /checkout/shipping-quotes Returns shipping method quotes
EventsApi listEvents GET /events Returns a list of events
EventsApi retrieveEvents GET /events/{id} Gets an event by identifier
FeesApi createFees POST /fees Creates a fee
FeesApi deleteFees DELETE /fees/{id} Deletes a fee by identifier
FeesApi listFees GET /fees Returns a list of fees
FeesApi retrieveFees GET /fees/{id} Gets a Fee by identifier
FeesApi updateFees POST /fees/{id} Updates an existing Fee
FileLinksApi createFileLinks POST /file-links Creates a file link
FileLinksApi deleteFileLinks DELETE /file-links/{id} Deletes a file link by ID.
FileLinksApi listFileLinks GET /file-links Returns a list of file links
FileLinksApi retrieveFileLinks GET /file-links/{id} Gets a file link by identifer
FileLinksApi updateFileLinks POST /file-links/{id} Updates a file link
FilesApi createFiles POST /files Creates a file.
FilesApi deleteFiles DELETE /files/{id} Deletes a file by ID.
FilesApi downloadFiles GET /files/{id}/content Gets file content by ID.
FilesApi listFiles GET /files Returns a list of files.
FilesApi retrieveFiles GET /files/{id} Gets a file by ID.
FulfillmentCancellationsApi createFulfillmentCancellations POST /fulfillment-cancellations Creates a cancellation
FulfillmentCancellationsApi listFulfillmentCancellations GET /fulfillment-cancellations Returns a list of fulfillment cancellations
FulfillmentCancellationsApi retrieveFulfillmentCancellations GET /fulfillment-cancellations/{id} Gets a fulfillment cancellation by its unique identifier.
FulfillmentOrdersApi createFulfillmentOrders POST /fulfillment-orders Creates a new Fulfillment order
FulfillmentOrdersApi listFulfillmentOrders GET /fulfillment-orders Returns a list of Fulfillment orders.
FulfillmentOrdersApi retrieveFulfillmentOrders GET /fulfillment-orders/{id} Gets a Fulfillment order by ID.
FulfillmentReturnsApi createFulfillmentReturns POST /fulfillment-returns Creates a return
FulfillmentReturnsApi listFulfillmentReturns GET /fulfillment-returns Returns a list of fulfillment returns
FulfillmentReturnsApi retrieveFulfillmentReturns GET /fulfillment-returns/{id} Gets a fulfillment return by its unique identifier
FulfillmentsApi createFulfillments POST /fulfillments Creates a Fulfillment
FulfillmentsApi listFulfillments GET /fulfillments Returns a list of Fulfillments.
FulfillmentsApi retrieveFulfillments GET /fulfillments/{id} Gets a Fulfillment by unique identifier
InventoryItemsApi createInventoryItems POST /inventory-items Creates an inventory item.
InventoryItemsApi deleteInventoryItems DELETE /inventory-items/{id} Deletes an inventory item by ID.
InventoryItemsApi listInventoryItems GET /inventory-items Returns a list of inventory items.
InventoryItemsApi retrieveInventoryItems GET /inventory-items/{id} Gets an inventory item by ID.
InventoryItemsApi updateInventoryItems POST /inventory-items/{id} Updates an inventory item.
InventoryLevelsApi listInventoryLevels GET /inventory-levels Returns a list of inventory levels.
InvoicesApi attachSourceToInvoice POST /invoices/{id}/sources/{sourceId} Attach source to invoice.
InvoicesApi createInvoices POST /invoices Creates a new invoice
InvoicesApi deleteInvoices DELETE /invoices/{id} Deletes an invoice.
InvoicesApi detachSourceToInvoice DELETE /invoices/{id}/sources/{sourceId} Deletes a invoice association to source.
InvoicesApi listInvoices GET /invoices Returns a list of invoices
InvoicesApi openInvoices POST /invoices/{id}/open Opens an existing invoice
InvoicesApi retrieveInvoices GET /invoices/{id} Gets an invoice by identifier
InvoicesApi updateInvoices POST /invoices/{id} Updates an existing invoice
InvoicesApi voidInvoices POST /invoices/{id}/void Voids an existing invoice
LogisticsReturnsApi createLogisticsReturns POST /logistics-returns Creates a return
LogisticsReturnsApi listLogisticsReturns GET /logistics-returns Returns a list of returns
LogisticsReturnsApi retrieveLogisticsReturns GET /logistics-returns/{id} Gets a return by ID
OrdersApi createOrders POST /orders Creates a new order.
OrdersApi listOrders GET /orders Returns a list of orders.
OrdersApi retrieveOrderTracking GET /orders/{id}/tracking Tracks Global Logistics shipments.
OrdersApi retrieveOrders GET /orders/{id} Gets an order by ID.
OrdersApi updateOrders POST /orders/{id} Updates an existing order.
PayoutTransactionsApi listPayoutTransactions GET /payouts/{id}/transactions Lists the payout transactions for a payout.
PayoutsApi listPayouts GET /payouts Returns a list of payouts
PayoutsApi retrievePayouts GET /payouts/{id} Gets a payout by ID.
PlansApi createPlans POST /plans Creates a Plan
PlansApi deletePlans DELETE /plans/{id} Deletes a Plan by ID
PlansApi listPlans GET /plans Returns a list of Plans
PlansApi retrievePlans GET /plans/{id} Gets a Plan by ID
PlansApi updatePlans POST /plans/{id} Updates a Plan
RefundsApi createRefunds POST /refunds Creates a refund for an order.
RefundsApi listRefunds GET /refunds Returns a list of refunds
RefundsApi retrieveRefunds GET /refunds/{id} Gets a refund by ID.
RefundsApi updateRefunds POST /refunds/{id} Updates a refund for an order or a specific order charge.
ReservationsApi createReservations POST /reservations Create a reservation
ReservationsApi deleteReservations DELETE /reservations/{id} Cancels a reservation by ID.
ReturnsApi createReturns POST /returns Creates a return
ReturnsApi listReturns GET /returns Returns a list of returns
ReturnsApi retrieveReturns GET /returns/{id} Gets a return by ID
ReturnsApi updateReturns POST /returns/{id} Updates an existing return
SKUsApi createSkus POST /skus Creates a SKU
SKUsApi deleteSkus DELETE /skus/{id} Deletes a SKU by ID
SKUsApi listSkus GET /skus Returns a list of SKUs
SKUsApi retrieveSkus GET /skus/{id} Gets a SKU by ID
SKUsApi updateSkus POST /skus/{id} Updates a SKU
SKUsApi upsertSkus PUT /skus/{id} Upserts a SKU
SalesSummariesApi listSalesSummaries GET /sales-summaries Returns a list of sales summaries
SalesSummariesApi retrieveSalesSummaries GET /sales-summaries/{id} Gets a sales summary by ID.
SalesTransactionsApi listSalesTransactions GET /sales-transactions Returns a list of sales transactions
SalesTransactionsApi retrieveSalesTransactions GET /sales-transactions/{id} Gets a sales transaction by ID.
ShipmentsApi listShipments GET /shipments Returns a list of shipments
ShipmentsApi retrieveShipments GET /shipments/{id} Gets a shipment by ID.
ShippingLabelsApi createShippingLabel POST /shipping-labels Returns shipping label
ShippingLabelsApi listShippingLabel GET /shipping-labels Returns shipping label
ShippingLabelsApi retrieveShippingLabels GET /shipping-labels/{id} Gets a shipping label by ID.
ShippingQuotesApi postShippingQuotes POST /shipping-quotes Returns shipping quotes
SkuGroupsApi listSkuGroups GET /sku-groups Returns a list of SKU Groups
SourcesApi createSources POST /sources Posts a source
SourcesApi retrieveSources GET /sources/{id} Gets a source by identifier
StoreCreditCalloutApi removeStoreCreditsCallout DELETE /checkouts/store-credits/{upstreamId} Remove store credit callout
StoreCreditCalloutApi storeCreditsCallout POST /checkouts/store-credits Store credit callout
SubscriptionsApi deleteSubscriptions DELETE /subscriptions/{id} Deletes a Subscription by ID
SubscriptionsApi listSubscriptions GET /subscriptions Returns a list of Subscriptions
SubscriptionsApi retrieveSubscriptions GET /subscriptions/{id} Gets a Subscription by ID
SubscriptionsApi updateSubscriptions POST /subscriptions/{id} Updates a Subscription
TaxIdentifiersApi createTaxIdentifiers POST /tax-identifiers Creates a new tax identifier
TaxIdentifiersApi deleteTaxIdentifiers DELETE /tax-identifiers/{id} Deletes a tax identifier by ID.
TaxIdentifiersApi listTaxIdentifiers GET /tax-identifiers Returns a list of tax identifiers
TaxIdentifiersApi retrieveTaxIdentifiers GET /tax-identifiers/{id} Gets a tax identifier by ID.
WebhooksApi createWebhooks POST /webhooks Creates a new webhook
WebhooksApi deleteWebhooks DELETE /webhooks/{id} Deletes a webhook endpoint by ID.
WebhooksApi listWebhooks GET /webhooks Returns a list of webhooks
WebhooksApi retrieveWebhooks GET /webhooks/{id} Gets a webhook endpoint by ID.
WebhooksApi updateWebhooks PATCH /webhooks/{id} Updates an existing webhook endpoint

Documentation For Models

Documentation For Authorization

apiKey

  • Type: API key
  • API key parameter name: X-API-KEY
  • Location: HTTP header

basicAuth

  • Type: HTTP basic authentication

bearerAuth

  • Type: Bearer authentication

Author

About

PHP SDK for integrating the Digital River API into your commerce app.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages