top

Billing API

To use Samsung Product API, 

<script type="text/javascript" src="$WEBAPIS/webapis/webapis.js"></script>

Should be loaded in index.html

The module defines the functionalities of getting Billing function that are provides as the Samsung TV for Tizen Platform Billing API.

Since : 1.0

Table of Contents

  1. 1. Interfaces
    1. 1.1. BillingManagerObject
    2. 1.2. BillingManager
    3. 1.3. BillingBuyDataSuccessCallback
    4. 1.4. BillingBuyData
  2. 2. Full WebIDL

Summary of Interfaces and Methods

Interface Method
BillingManagerObject  
BillingManager void buyItem(DOMString appid, DOMString serverType,DOMString paymentDetails,BillingBuyDataSuccessCallback onsuccess, optional ErrorCallback ? onerror);
BillingBuyDataSuccessCallback void onsuccess();
BillingBuyData  

1. Interfaces

1.1. BillingManagerObject

The interface defines what is instantiated by the WebApi object of Samsung TV for Tizen Platform Billing API.
There will be a webapis.billing object that allows access to the functionality of the Billing API

[NoInterfaceObject]interface BillingManagerObject {
    readonly attribute BillingManager billing;
};

WebApi implements BillingManagerObject;

Since : 1.0

Attributes

  • readonly BillingManager billing
    Namespace for Billing API.

    Since : 1.0

1.2. BillingManager

This interface provides methods to use the billing functionalities.

[NoInterfaceObject]interface BillingManager {
    void buyItem(DOMString appid, DOMString serverType,DOMString paymentDetails,BillingBuyDataSuccessCallback  onsuccess, optional ErrorCallback ? onerror);		
};

Since : 1.0

Methods

buyItem
web app invoke this API to active Billing Client to do purchase.

void buyItem(DOMString appid, DOMString serverType,DOMString paymentDetails,BillingBuyDataSuccessCallback  onsuccess, optional ErrorCallback ? onerror);

Since : 1.0

Privilege level: public

Privilege: http://developer.samsung.com/privilege/billing

Parameters:

  • appid: DOMString AppID provided by Samsung Seller Site
  • serverType: DOMString Parameter for the selection of payment server

    “DEV” : When using DPI Staging Zone (during development, during QA))
    - Parameter accessing through Staging Zone server

    “PRD” : When using DPI Operating Zone (Actual User Environment))
    - Parameter accessing through the actual payment server
  • paymentDetails: DOMString See "Payment Details info" for more details
  • onsuccess: [MANDATORY] BillingBuyDataSuccessCallback
  • onerror: [OPTIONAL] ErrorCallback
  • [Payment Details info]
    - OrderItemID[MANDATORY]
    * Use the ItemID issued by DPI ‘cont/list’ API
    Item ID for purchase (ex. A-001)

    - OrderTitle[MANDATORY]
    * Use the ItemTitle issued by DPI ‘cont/list’ API
    Purchase title

    - OrderTotal[MANDATORY]
    * Use the Price issued by DPI ‘cont/list’ API
    * Price should be changed to String datatype
    Total purchase amount

    - OrderCurrencyID[MANDATORY]
    * Use the CurrencyID issued by DPI ‘cont/list’ API.
    Currency code (ex: USD)

    - OrderID[OPTIONAL]
    Management ID for purchase managed by the third party application

    - OrderCustomID[MANDATORY]
    * Use the same value with CustomID parameter of DPI ‘invoice/list’ API
    Value for user identification.
    ? If the value of the OrderCustomID is """" or NULL, Samsung Account UID value is used."

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if the input parameter is not compatible with the expected type.

    • with error type NotSupportedError, if this feature is not supported.

    • with error type InvalidValuesError, if any of the input parameters contain an invalid value.

    • with error type UnknownError in any other error case.

Code example:


var strUID = webapis.sso.getLoginUid();

var onsuccess = function(data) { 
};

var onerror = function(error) { 
};

var paymentDetails = new Object(); 
 paymentDetails.OrderItemID="PID_2_consum_cupn"; 
 paymentDetails.OrderTitle="hello consum US coupon"; 
 paymentDetails.OrderTotal="2"; 
 paymentDetails.OrderCurrencyID="USD"; 
 paymentDetails.OrderCustomID=strUID; 

var stringifyResult = JSON.stringify(paymentDetails);
webapis.billing.buyItem("3201503001547","PRD",stringifyResult,onsuccess,onerror);

1.3. BillingBuyDataSuccessCallback

This callback interface defines callback info from Billing.

[Callback = FunctionOnly, NoInterfaceObject]interface BillingBuyDataSuccessCallback {
    void onsuccess(BillingBuyData data);
};

Since : 1.0

Methods

onsuccess
This method receive success callback info from Billing.

void onsuccess(BillingBuyData data);

Since : 1.0

Parameters:

  • data: BillingBuyData info about buyItem

Code example:


 var onsuccess = function(data) {
 addResult("[Billing buyItem]: pay_result [" + data.payResult + "], pay_detail [" + data.payDetail + "]");
 };

1.4. BillingBuyData

This interface defines the callback info of Billing

[NoInterfaceObject] interface BillingBuyData{		
    readonly attribute DOMString payResult;
    readonly attribute DOMString payDetail;		
};

Since : 1.0

Attributes

  • readonly DOMString payResult
    DOMString

    Since : 1.0

  • readonly DOMString payDetail
    DOMString

    Since : 1.0


module Billing {
	[NoInterfaceObject]interface BillingManagerObject {
		readonly attribute BillingManager billing;
	};
	WebApi implements BillingManagerObject;

	[NoInterfaceObject]interface BillingManager {
		void buyItem(DOMString appid, DOMString serverType,DOMString paymentDetails,BillingBuyDataSuccessCallback  onsuccess, optional ErrorCallback ? onerror);		
	};

	[Callback = FunctionOnly, NoInterfaceObject]interface BillingBuyDataSuccessCallback {
		void onsuccess(BillingBuyData data);
	};
  
	[NoInterfaceObject] interface BillingBuyData{		
		readonly attribute DOMString payResult;
		readonly attribute DOMString payDetail;		
	};	
};