Skip to main content

Overview

Allows the client to initiate the process of buying eDaler, using a service provider that does not use a smart contract as the basis for the transaction (i.e. a service provider that will require the client to open a third-party page to complete the transaction). Note: Service Providers publishing a smart contract template as the basis of operation start processing transactions when the contract has been created and signed by the client and the Trust Provider. There is no need to initiate the process by calling this resource in such cases.

HTTP request

POST /Agent/Wallet/InitiateBuyEDaler

Authentication

Requires a valid JWT bearer token.

Request (JSON)

{
	"serviceId": Required(Str(PServiceId)),
	"serviceProvider": Required(Str(PServiceProvider)),
	"amount": Required(Double(PAmount)),
	"currency": Required(Str(PCurrency)),
	"successUrl": Optional(Str(PSuccessUrl)),
	"failureUrl": Optional(Str(PFailureUrl)),
	"cancelUrl": Optional(Str(PCancelUrl)),
	"transactionId": Optional(Str(PTransactionId)),
	"tabId": Optional(Str(PTabId)),
	"functionName": Optional(Str(PFunctionName))
}

Input parameters

ParameterDescription
PServiceIdID of service to use.
PServiceProviderID of service provider publishing the service selected.
PAmountAmount of eDaler to buy.
PCurrencyCurrency of eDaler to buy.
PSuccessUrlOptional URL to call from Client web page, when the transaction has concluded successfully.
PFailureUrlOptional URL to call from Client web page, if the transaction fails.
PCancelUrlOptional URL to call from Client web page, if the client cancels the transaction.
PTransactionIdOptional ID of transaction.
PTabIdOptional TAB ID. Used by Events.js, and can be used to inform the client when a change is reported for the transaction.
PFunctionNameOptional name of Javascript function to call if Events.js is included, and a Tab ID is reported.

Response (JSON)

{
	"id":Required(Str(PId)),
	"state":Required(Str(PState)),
	"started":Required(DateTime(PStarted)),
	"ended":Optional(DateTime(PEnded)),
	"serviceId": Required(Str(PServiceId)),
	"serviceProvider": Required(Str(PServiceProvider)),
	"amount": Required(Double(PAmount)),
	"currency": Required(Str(PCurrency)),
	"successUrl": Optional(Str(PSuccessUrl)),
	"failureUrl": Optional(Str(PFailureUrl)),
	"cancelUrl": Optional(Str(PCancelUrl)),
	"clientUrl": Optional(Str(PClientUrl))
}

Response parameters

ParameterDescription
IdID of transaction.
StateState of transaction. Possible values are Created, Preparing, Prepared, Executing, Executed, Committing, Committed, RollingBack, RolledBack and Error.
StartedWhen transaction started.
EndedWhen (if) transaction ended.
PServiceIdID of service to use.
PServiceProviderID of service provider publishing the service selected.
PAmountAmount of eDaler to buy.
PCurrencyCurrency of eDaler to buy.
PSuccessUrlOptional URL to call from Client web page, when the transaction has concluded successfully.
PFailureUrlOptional URL to call from Client web page, if the transaction fails.
PCancelUrlOptional URL to call from Client web page, if the client cancels the transaction.
PClientUrlURL to third-party web page that the client needs to open and complete, for the transaction to take place.

Notes

This endpoint uses the request schema notation described in Pattern matching.