Вы находитесь на странице: 1из 20

API ukrbuy.

com
v.1.2 18.10.2010
http://ukrbuy.com/partner/

1. .............................................................................................................................................. 2
1.1. .......................................................................................................... 2
1.2. ................................................................................................................... 2
1.3. ....................................................................................................................................... 3
1.4. .............................................................................................................................. 3
1.5. ................................................................................................ 4
2. ........................................................................................................................................................... 4
2.1. Availiable .................................................................................................................................... 4
2.3. Validate ...................................................................................................................................... 5
2.4. Operation ................................................................................................................................... 6
Operation ResultCode = 413 ( OperationData ) .......................................................... 7
Operation ResultCode = 422 ( OperationData )................................................................ 8
2.5. OperationData .........................................................................................................................12
2.6. Check ........................................................................................................................................14
2.7. Catalog .....................................................................................................................................16
3. (ReturnCode) .............................................................................................................18
4. (ResultCode) ............................................................................................19

1.
1.1.
:
ukrbuy.com,
API.
, .
.
, ,

.
.
, .
,
( , ..).
API
, .
html-
WebMoney Merchant . ( WMU)
WebMoney Merchant
. ,
, , WMU
..
http://ukrbuy.com/partner/ .
,
http://ukrbuy.com/partner/.
API XML-
. :
(Catalog);
(Availiable);
(Validate);
(Operation);
(OperationData );
(Check);

Avaliable

Validate

Operation

Check

OperationData

1.2.
2

HTTP POST
text/xml (XML-). - "UTF-8".
HTTP-
"Content-type":
Content-Type: text/xml; charset=utf-8

http://ukrbuy.com/api.php
,
HTTP- "200 OK", XML-
:
<ReturnCode>0</ReturnCode>
<ReturnMessage>OK</ReturnMessage>

! , HTTP-
, "200 OK",
(). .
, XML-
ReturnCode , 0, ReturnMessage
. 3.
1.3.

HTTP-:
X-GC-Auth-Point (
http://ukrbuy.com/partner/interfaces/description);
X-GC-Auth-Pass Base64 (
http://ukrbuy.com/partner/interfaces/description).
:
X-GC-Auth-Point: 1
X-GC-Auth-Pass: cGFzc3dvc9Q=

HTTP- X-GC-Auth-Sign
Base64. SHA1
() HTTP- . PHP:
sha1($response . $password);

:
X-GC-Auth-Sign: F4kH/V7rVJu/BubysUe7iNsFNU+qSndmPecJfSZw/LrfJYxraigvsXUxHbts0jqYtbAahm
8s4rFjNZF5Wu35k0/XxyFs5jCLKAvbXcZiJf8pWnauuM3hyw7mmOb6Qn/w+DVxf2fiLL3v
d3eXN6NdBEZDk/FnYv5ItJ2+N9T0bO8=

.
1.4.
3

( ):
INT - , , 2^16,
, "12345";
VARCHAR(n) - , n, , "qwerty";
MONEY - , 0
4 , , "1.0000", "0.01";
VOLUME - , MONEY V A,
, "12345.012V", "24A";
PARAMS , ,
;. PARAMS
,
( Catalog).
1.5.
, (Catalog)
:
ResultCode ;
ResultMessage ;
ResultData , .
4.

2.
2.1. Availiable

. , ,
.

, ,
.
:

ServiceId INT

:
<AvailableRequest>
<Commands>
<AvailableRequestCommand>
<ServiceId>1</ServiceId>
</AvailableRequestCommand>
</Commands>
</AvailableRequest>

:
4

<Response>
<ReturnCode>0</ReturnCode>
<ReturnMessage>OK</ReturnMessage>
<Commands>
<AvailableResponseCommand>
<ResultCode>0</ResultCode>
<ResultMessage> </ResultMessage>
</AvailableResponseCommand>
</Commands>
</Response>

2.3. Validate

( , ..,
) .
:

ServiceId
Volume
Params

INT
VOLUME
PARAMS

1
1, 1V, 1A
380913016166

Calculate\Amount
Calculate\Value
Calculate\AgentFee

MONEY
MONEY
MONEY

Calculate\Price

MONEY



,
( WMU)
(WMU)

1
1
0.012
1.02

:
<ValidateRequest>
<Commands>
<ValidateRequestCommand>
<ServiceId>1</ServiceId>
<Volume>10A</Volume>
<Params>380913016166</Params>
</ValidateRequestCommand>
</Commands>
</ValidateRequest>

Volume (
A, : 100A), ( V,
: 100V, , : 100).
,
8 . ,
10 , Volume 10A, 80V, 80.
,
( Catalog).
5

Params (;) ,
( Catalog).
:
<Response>
<ReturnCode>0</ReturnCode>
<ReturnMessage>OK</ReturnMessage>
<Commands>
<ValidateResponseCommand>
<ResultCode>0</ResultCode>
<ResultMessage> </ResultMessage>
<ResultData>
<Calculate>
<Amount>10</Amount>
<Value>80</Value>
<AgentFee>0.98</AgentFee>
<Price>81.6</Price>
</Calculate>
</ResultData>
</ValidateResponseCommand>
</Commands>
</Response>

, ( 10
Volume=10A), : Amount=10 (), Value=80
().
Price , ,
( ,
). ,
2%. 10 (80 ),
81.6 WMU.
. (
). . ,
Amount, Value Price .
2.4. Operation

WebMoney Merchant .
:

OperationId VARCHAR(64) ,

INT

ServiceId
VOLUME

Volume

PARAMS

Params

TerminalId INT

123_250509
1
1, 1V, 1A
380913016166
122

:
<OperationRequest>
<Commands>
<OperationRequestCommand>

<ServiceId>1</ServiceId>
<OperationId>125206188472552900</OperationId>
<Volume>1</Volume>
<Params>380913016166</Params>
<TerminalId>122</TerminalId>
</OperationRequestCommand>
</Commands>
</OperationRequest>

OperationId ( ) .
.

.
OperationId , .
PHP:
<?
function createOperationId()
{
list($usec, $sec) = explode(" ", substr(microtime(), 2));
return $sec . $usec;
}
?>

OperationId - 64 (). :
"1112" - .
"1113_1228" - .
"1114_12282359" - .
,
( Catalog).
Params (;) ,
( Catalog).
TerminalId , ,
() .
() ,
(, - http://ukrbuy.com/partner/statistic/all)
. ,
http://ukrbuy.com/partner/site. (TerminalId).
Operation .
Operation ResultCode = 413, ,
.
Operation ResultCode = 422, ,
OperationData.
Operation ResultCode = 413 ( OperationData )

ResultCode = 413:
<Response>
<ReturnCode>0</ReturnCode>
<ReturnMessage>OK</ReturnMessage>
<Commands>
<OperationResponseCommand>
<ResultCode>413</ResultCode>
<ResultMessage> </ResultMessage>

<ResultData>
<Forms>
<Webmoney>
<Action>https://merchant.webmoney.ru/lmi/payment.asp</Action>
<Method>POST</Method>
<Fields>
<LMI_PAYEE_PURSE>U727440296579</LMI_PAYEE_PURSE>
<LMI_PAYMENT_AMOUNT>5.00</LMI_PAYMENT_AMOUNT>
<LMI_PAYMENT_DESC> Vega: 2450298; (Id:711246)
</LMI_PAYMENT_DESC>
<LMI_PAYMENT_NO>711246</LMI_PAYMENT_NO>
</Fields>
</Webmoney>
</Forms>
</ResultData>
<OperationId>1282200481000</OperationId>
</OperationResponseCommand>
</Commands>
</Response>

, Operation c ResultCode = 413


Forms html- WebMoney Merchant
. :
1. Forms;
2. html-;
3. WebMoney Merchant .
, html-
WebMoney Merchant Operation, :
<form method="POST" action="https://merchant.webmoney.ru/lmi/payment.asp">
<input type="hidden" name="LMI_PAYMENT_NO" value="711246">
<input type="hidden" name="LMI_PAYMENT_AMOUNT" value="5.00">
<input type="hidden" name="LMI_PAYEE_PURSE" value="U727440290579">
<input type="hidden" name="LMI_SUCCESS_URL" value="http://SITENAME/payment/gc?action=yes">
<input type="hidden" name="LMI_FAIL_URL" value="http://SITENAME/payment/gc/no">
<input type="hidden" name="LMI_PAYMENT_DESC" value=" Vega:
2450298; (Id:711246)">
<input type="submit" value=" " >
</form>

LMI_SUCCESS_URL LMI_FAIL_URL
, WebMoney Merchant
, .
html-, ukrbuy.com.
Windows-1251,
LMI_PAYMENT_DESC,
LMI_PAYMENT_DESC_BASE64, Base64.
PHP:
<input type="hidden" name="LMI_PAYMENT_DESC" value="<?php=base64_encode(
Vega: 2450298; (Id:711246))?>">

Operation ResultCode = 422 ( OperationData )

, , ,
(, , ,
, ..). Operation
ResultCode = 422.
8

ResultCode = 422:
<Response>
<ReturnCode>0</ReturnCode>
<ReturnMessage>OK</ReturnMessage>
<Commands>
<OperationResponseCommand>
<ResultCode>422</ResultCode>
<ResultMessage> </ResultMessage>
<ResultData>
<WaitData>
<Data>
<Name></Name>
<Type>Info</Type>
<Readonly>1</Readonly>
<Value>I . .</Value>
</Data>
<Data>
<Name> </Name>
<Type>Counter</Type>
<Discount>0.11</Discount>
<PrevCounter>100</PrevCounter>
<Counter>200</Counter>
<Id>10</Id>
</Data>
<Data>
<Name></Name>
<Type>Info</Type>
<Readonly>1</Readonly>
<Value>200</Value>
</Data>
<Data>
<Name> </Name>
<Type>FreePayment</Type>
<Readonly>0</Readonly>
<Value>200</Value>
</Data>
</WaitData>
</ResultData>
<OperationId>128594277776698100</OperationId>
</OperationResponseCommand>
</Commands>
</Response>

, Operation c ResultCode = 422


WaitData html- .
:
1. WaitData;
2. html-;
3. html-;
4. OperationData.
, , Operation XML-,
HTML, HTML-
XML- OperationData.
<Data></Data> WaitData
. <Data></Data> Type,
(-) (-). Data/Type.
Data/Type = Info
html-, html-
, ( ).
9

Operation:
<Data>
<Name></Name>
<Type>Info</Type>
<Readonly>1</Readonly>
<Value>200</Value>
</Data>

html-:
: <b>200</b>

:
<input type=text value="1" readonly>

OperationData .
Data/Type = FreePayment
html- ,
, .
Operation:
<Data>
<Name> </Name>
<Type>FreePayment</Type>
<Readonly>0</Readonly>
<Value>200</Value>
</Data>

html-:
<input name="Param2Name" value=" " type="hidden">
: <input type="text" value="200" name="Param2Price">

, 2 (name) html-
, , ,
,
OperationData
.
, html- , ,
200 150. OperationData :
<Param>
<Name> </Name>
<Discount></Discount>
<Counter></Counter>
<PrevCounter></PrevCounter>
<Price>150</Price>
<Difference></Difference>
</Param>

Data/Type = Counter
html- .
:
10

( Data/Type/Discount);
(
Data/Type/PrevCounter);
(
Data/Type/Counter);
(
, , javascript);
(
*, , javascript).
, .
Operation:
<Data>
<Type>Counter</Type>
<Name> </Name>
<Discount>0.11</Discount>
<PrevCounter>100</PrevCounter>
<Counter>200</Counter>
<Id>10</Id>
</Data>

html-:
<b> :</b><br>
<input name="Param0Discount" value="0.11" type="text"><br>
<input name="Param0PrevCounter" value="100" type="text"><br>
<input name="Param0Counter" value="200" type="text"><br>
<input name="Param0Difference" value="100" readonly type="text"><br>
<input name="Param0Price" value="11" type="text"><br>

, (name) html-
, ,
,
OperationData
.
, html- 200 220,
0.11 0.09 ( ). OperationData
:
<Param>
<Name> </Name>
<Discount>0.09</Discount>
<Counter>220</Counter>
<PrevCounter>100</PrevCounter>
<Difference>120</Difference>
<Price>10.8</Price>
<Id>10</Id>
</Param>

, html-, WaitData
Operation ResultCode = 422, :
<form method="POST" action="URL ">
: <b>I . .</b><br>
<b> :</b><br>
<input name="Param0Discount" value="0.11" type="text"><br>
<input name="Param0PrevCounter" value="100" type="text"><br>

11

<input name="Param0Counter" value="200" type="text"><br>


<input name="Param0Difference" value="100" readonly type="text"><br>
<input name="Param0Price" value="11" type="text"><br>
: <b>200</b><br>
<input name="Param2Name" value=" " type="hidden">
: <input type="text" value="200" name="Param2Price">
<input type=submit value=""><br>
</form>

2.5. OperationData

(, , ..)
WebMoney Merchant .
OperationData ,
Operation ResultCode = 422. OperationData
Operation.
:

OperationId

VARCHAR(64)

ServiceId
Volume

INT
VOLUME

Params
Params/Param/Name

VARCHAR(255)

Params/Param/Discount
Params/Param/Counter
Params/Param/PrevCounter

MONEY
MONEY
MONEY

Params/Param/Difference

MONEY

Params/Param/Price

MONEY

Params/Param/Id

INT

()


, ,
.



Difference=
Counter-PrevCounter
,

,
(

Price=Discount*Difference)
.
,
Param/Id
Operation
.

123_250509

1
1, 1V, 1A

0.5

12

:
<OperationDataRequest>
<Commands>
<OperationDataRequestCommand>
<ServiceId>35</ServiceId>
<OperationId>128594277776698100</OperationId>
<Volume>160.8</Volume>
<Params>
<Param>
<Name> </Name>
<Discount>0.09</Discount>
<Counter>220</Counter>
<PrevCounter>100</PrevCounter>
<Difference>120</Difference>
<Price>10.8</Price>
<Id>10</Id>
</Param>
<Param>
<Name> </Name>
<Discount></Discount>
<Counter></Counter>
<PrevCounter></PrevCounter>
<Difference></Difference>
<Price>150</Price>
</Param>
</Params>
</OperationDataRequestCommand>
</Commands>
</OperationDataRequest>

<Param></Param>
Operation ( ResultCode = 422).
OperationData ResultCode = 413, ,
, .
OperationData ResultCode = 422, ,
, .
OperationData,
.
ResultCode = 413:
<Response>
<ReturnCode>0</ReturnCode>
<ReturnMessage>OK</ReturnMessage>
<Commands>
<OperationDataResponseCommand>
<ResultCode>413</ResultCode>
<ResultMessage> </ResultMessage>
<ResultData>
<Forms>
<Webmoney>
<Action>https://merchant.webmoney.ru/lmi/payment.asp</Action>
<Method>POST</Method>
<Fields>
<LMI_PAYEE_PURSE>U727440290579</LMI_PAYEE_PURSE>
<LMI_PAYMENT_AMOUNT>160.8</LMI_PAYMENT_AMOUNT>
<LMI_PAYMENT_DESC> 1000120161;09;2010;1; (Id:711462)
</LMI_PAYMENT_DESC>
<LMI_PAYMENT_NO>711462</LMI_PAYMENT_NO>
</Fields>
</Webmoney>
</Forms>
<WaitData>
<Data>
<Name></Name>
<Type>Info</Type>

13

<Readonly>1</Readonly>
<Value>I . .</Value>
</Data>
<Data>
<Name> </Name>
<Type>Counter</Type>
<Discount>0.09</Discount>
<PrevCounter>100</PrevCounter>
<Counter>220</Counter>
</Data>
<Data>
<Name></Name>
<Type>Info</Type>
<Readonly>1</Readonly>
<Value>200</Value>
</Data>
<Data>
<Name> </Name>
<Type>FreePayment</Type>
<Readonly>0</Readonly>
<Value>150</Value>
</Data>
</WaitData>
</ResultData>
<OperationId>1282200481000</OperationId>
</OperationDataResponseCommand>
</Commands>
</Response>

, OperationData ResultCode = 413


Forms html- WebMoney Merchant
. :
1. Forms;
2. html-;
3. WebMoney Merchant .
ResultCode = 413 OperationData <WaitData></WaitData>,
, .
,
ResultCode = 422.
, html-
WebMoney Merchant OperationData, :
<form method="POST" action="https://merchant.webmoney.ru/lmi/payment.asp">
<input type="hidden" name="LMI_PAYMENT_NO" value="711462">
<input type="hidden" name="LMI_PAYMENT_AMOUNT" value="160.8">
<input type="hidden" name="LMI_PAYEE_PURSE" value="U727440290579">
<input type="hidden" name="LMI_SUCCESS_URL" value="http://SITENAME/payment/gc?action=yes">
<input type="hidden" name="LMI_FAIL_URL" value="http://SITENAME/payment/gc/no">
<input type="hidden" name="LMI_PAYMENT_DESC" value="
1000120161;09;2010;1; (Id:711462)">
<input type="submit" value=" ">
</form>

LMI_SUCCESS_URL LMI_FAIL_URL
, WebMoney Merchant
, .
html-, ukrbuy.com.
2.6. Check
.
14

OperationId VARCHAR(64) ,

123_250509

Amount
Created
Executed
Params
Params\Data
Params\Data\Key

MONEY
WMU,
DATETIME

DATETIME
( )
,

VARCHAR

Params\Data\Value VARCHAR

500.00
2010-1011T18:31:56
2010-1011T18:32:23

409970935

:
<CheckRequest>
<Commands>
<CheckRequestCommand>
<OperationId>125206188472552900</OperationId>
</CheckRequestCommand>
</Commands>
</CheckRequest>

:
<Response>
<ReturnCode>0</ReturnCode>
<ReturnMessage>OK</ReturnMessage>
<Commands>
<CheckResponseCommand>
<ResultCode>407</ResultCode>
<ResultMessage> </ResultMessage>
<ResultData>
<Amount>500.00</Amount>
<Created>2010-10-11T18:31:56</Created>
<Executed>2010-10-11T18:32:23</Executed>
<Params>
<Data>
<Key> </Key>
<Value>19592328905359</Value>
</Data>
<Data>
<Key> </Key>
<Value>409970935</Value>
</Data>
</Params>
</ResultData>
<OperationId>125206188472552900</OperationId>
</CheckResponseCommand>
</Commands>
</Response>

, ( ),
ResultCode. 407.
15


, Check (
<Data></Data>). , life :) ,
, -
. ( , )
() .
2.7. Catalog
.
:
<CatalogRequest>
<ReturnCode>0</ReturnCode>
<ReturnMessage>OK</ReturnMessage>
<Commands>
<CatalogRequestCommand>
</CatalogRequestCommand>
</Commands>
</CatalogRequest>

:
<Response>
<Commands>
<CatalogResponseCommand>
<Catalog>
<Service>
<Id>1</Id>
<Name> </Name>
<Description />
<Created>2009-07-13 16:15:14</Created>
<Image>http://ukrbuy.com/images/logos/58.jpg</Image>
<ExampleImage />
<Order>8</Order>
<Provider></Provider>
<Type></Type>
<CategoryId>1</CategoryId>
<Category> </Category>
<WaitData>0</WaitData>
<Params>
<Param>
<name> </name>
<regexp>^[0-9]+$</regexp>
<example1>0913016166</example1>
<example2 />
<example3 />
</Param>
</Params>
<AmountMin>1.0000</AmountMin>
<AmountMax>10000.0000</AmountMax>
<AmountStep>0.0100</AmountStep>
<ValueDiscount>1.0000</ValueDiscount>
<ValueCurrency></ValueCurrency>
<AgentFeeDiscount>0.0125</AgentFeeDiscount>
<FeeOutDiscount>0.0000</FeeOutDiscount>
<FeeOutMin>0.0000</FeeOutMin>
<FeeOutMax>0.0000</FeeOutMax>
</Service>
</Catalog>
<Catalog>
<Service>
<Id>30</Id>
<Name>-</Name>

16

<Description />
<Created>2009-12-08 19:00:00</Created>
<Image>http://ukrbuy.com/images/logos/9.gif</Image>
<ExampleImage />
<Order>12</Order>
<Provider></Provider>
<Type></Type>
<CategoryId>2</CategoryId>
<Category></Category>
<WaitData>0</WaitData>
<Params>
<Param>
<name> </name>
<regexp>^[0-9][0-9\.]+$</regexp>
<example1>1.101385214</example1>
<example2 />
<example3 />
</Param>
</Params>
<AmountMin>1.0000</AmountMin>
<AmountMax>2000.0000</AmountMax>
<AmountStep>0.0100</AmountStep>
<ValueDiscount>1.0000</ValueDiscount>
<ValueCurrency></ValueCurrency>
<AgentFeeDiscount>0.006</AgentFeeDiscount>
<FeeOutDiscount>0.0000</FeeOutDiscount>
<FeeOutMin>0.0000</FeeOutMin>
<FeeOutMax>0.0000</FeeOutMax>
</Service>
</Catalog>
</CatalogResponseCommand>
</Commands>
</Response>

( <Service></Service>) :

Id
Name

INT
VARCHAR

Description
Created

VARCHAR
DATE

Image
Order

VARCHAR
INT

Provider
Type
CategoryID

VARCHAR
VARCHAR
INT

Category

VARCHAR

WaitData

INT

URL ( ..)

(


)



,

,



(

OperationData): 0 , 1

30

2009-12-08
19:00:00
12

17


Params\Param

VARCHAR

Params\Param\name

VARCHAR
,
^[0-9]{12}$
Params\Param\regexp
,

VARCHAR

1.101385214
Params\Param\example1

Params\Param\example1 VARCHAR

Params\Param\example1 VARCHAR
MONEY

1.0000
AmountMin

MONEY

2000.0000
AmountMax

MONEY

0.0100
AmountStep

MONEY
1.0000
ValueDiscount

VARCHAR(3)
,
ValueCurrency
MONEY

0.006
AgentFeeDiscount
(
)
MONEY

0.0200
FeeOutDiscount
( )
MONEY
( 0.0100
FeeOutMin
WMU)
MONEY

5.0000
FeeOutMax
( WMU)
Params

3. (ReturnCode)
ReturnCode
0
101
201
202
203
204
205
206
207
208

ReturnMessage

POST
SSL
- ,

http- Content-Length
( 1048576 (1 ))
http- Content-Type
http- Content-Encoding
18

209
210
301

http-

4.
(ResultCode)
ResultCode
0
304
302
305
306
307
308
309
310
311
312
313
315
314
401
402
410
418
404
405
406
407
408
409
411
412
413
414
415
416
417
421
422
501
502
503
504
512
505
506

ResultMessage

(ServiceId)






/







.























19

507
508
509

20

Вам также может понравиться