Cách kết nối API Perfect Money (PM) với website của bạn

API Perfect Money

Perfect Money (PM) là hệ thống thanh toán điện tử giao dịch tài chính toàn cầu cho phép người dùng thực hiện các giao dịch thanh toán nhanh chóng và tiện lợi. Perfect Money được thành lập vào năm 2007 và từ đó đã trở nên phổ biến như một hệ thống thanh toán kỹ thuật số an toàn và đáng tin cậy. Nó hoạt động như một dịch vụ tài chính trực tuyến cho phép người dùng thực hiện các giao dịch và quản lý tiền của họ bằng điện tử. Dưới đây là cách tích hợp API Perfect Money vào hệ thống website của bạn và doanh nghiệp.

Nội dung bài viết

Giới thiệu tổng quát về API Perfect Money (PM)

1. Định dạng kiểu tiền tệ

Hệ thống Perfect Money hỗ trợ các loại tiền tệ như sau:

  • USD: số tiền chuyển tối thiểu là 0,01
  • EUR: số tiền chuyển tối thiểu là 0,01
  • VÀNG: số tiền chuyển tối thiểu tương đương 10 USD, tối đa 5 chữ số sau điểm
  • BTC: số tiền chuyển tối thiểu là 0,001, tối đa 6 chữ số sau điểm

2. API chuyển tiền trong Perfect Money.

Chuyển tiền Perfect Money là giao dịch do chủ sở hữu tài khoản Perfect Money thực hiện để chuyển tiền sang tài khoản Perfect Money khác.

Thông thường, chuyển tiền trong Perfect Money được chủ tài khoản thực hiện một cách tương tác bằng trình duyệt web (hoặc điện thoại PCS/WAP) để gửi thông tin thanh toán qua biểu mẫu nhập HTML (HDML/WML).

Bạn muốn chuyển tiền tự động mà không bị giám sát hay không cần nhập lại dữ liệu thủ công, để thực hiện điều này bạn sẽ phải gọi lên hệ thống để hệ thống xác thực sử dụng phương thức chuyển tiền qua API Perfect Money.

3. API lấy mã nạp tiền theo tên tài khoản Perfect Money.

Nạp tiền  theo tên tài khoản Perfect Money là giao dịch do chủ sở hữu tài khoản Perfect Money thực hiện để lấy tên của một tài khoản Perfect Money khác.

Thông thường, bạn có thể thấy Tên tài khoản của người nhận thanh toán khi bắt đầu hoạt động chuyển tiền trong cả giao diện WEB thứ tự và yêu cầu cung cấp API Perfect Money chuyển tiền tự động.

Bạn muốn nạp tiền tự động bạn cẩn triển khai xác nhận bổ sung tài khoản người nhận thanh toán và mở chức năng này qua API .

4. API lấy mã xác nhận mã bảo mật Perfect Money.

Mã xác nhận bảo mật tài khoản Perfect Money là giao dịch do chủ sở hữu tài khoản Perfect Money thực hiện để hoàn tất việc đăng ký tiền từ tài khoản Perfect Money khác vào tài khoản của chính họ.

Thông thường, việc xác nhận mã bảo mật Perfect Money được chủ tài khoản thực hiện tương tác bằng trình duyệt web (hoặc điện thoại PCS/WAP) để gửi thông tin thanh toán (mã bảo vệ) qua đầu vào biểu mẫu HTML (HDML/WML).

Bạn muốn Xác nhận mã bảo mật tự động này có thể yêu cầu xác nhận không cần giám sát hoặc xác nhận mà không cần nhập lại dữ liệu thủ công, điều này sẽ yêu cầu sử dụng phương thức API Perfect Money.

5. API lấy lịch sử tài khoản Perfect Money.

Lịch sử tài khoản Perfect Money của một tài khoản cụ thể chứa tất cả các giao dịch tiền cho tài khoản đó.

Bạn muốn lấy lịch sử giao dịch một cách tự động tác bạn sẽ phải yêu cầu xác minh một giao dịch cụ thể.

6. API lấy Số dư tài khoản Perfect Money.

Số dư tài khoản Perfect Money cho một tài khoản là số dư hiện tại của từng tài khoản tiền tệ Perfect Money cụ thể (USD, EUR, Vàng hoặc Bitcoin).

Bạn muốn lấy số dư tài khoản và muốn hiển thị số dư hoặc thông tin dẫn xuất trên trang web của bạn thì bạn cần xác thực để hệ thống Perfect Money(PM) trả dữ liệu qua API .

7. API lấy tỷ giá Perfect Money.

Người dùng thường xem trang tỷ giá bằng trình duyệt web hoặc nhập số tiền tương đương khi thực hiện chuyển tiền Perfect Money.

Bạn muốn lấy tỉ giá tự động tác vụ này thì bạn cần xác thực và gọi vào hệ thống của Perfect Money(PM) trả dữ liệu qua API tỉ giá.

8. API Perfect Money(PM) e-Voucher.

Perfect Money E-Voucher cho một tài khoản người dùng cụ thể chứa tất cả các e-Voucher do người dùng tạo, cả đã kích hoạt và không kích hoạt.

Kết nối tự động với hệ thống Perfect Money

Phần này cung cấp thông tin chi tiết để cho phép lập trình viên kết nối tự động website với hệ thống thanh toán Perfect Money qua API .

Nói chung, các trường đầu vào được cung cấp cho URL đã cho thông qua dạng HTML thuộc loại POST hoặc GET. Ví dụ: yêu cầu kiểu GET để truy xuất số dư tài khoản PerfectMoney 101574 có thể trông như sau:

https://perfectmoney.com/acct/balance.asp?AccountID=101574&PassPhrase=This1isnotReal 

Dữ liệu lịch sử và tỷ giá hối đoái được trả về ở định dạng được phân cách bằng dấu phẩy cho người yêu cầu. Các URL số dư, chuyển tiền và xem trước trả về dữ liệu kết quả trong các trường ẩn được nhúng trong HTML thông thường. Ví dụ: yêu cầu số dư ở trên có thể trả về:

<html>

 

<head>

  <title>Balance</title>

</head>

 

<body>

 

<h1>Balance</h1>

 

<table border=1>

<tr><td><b>Account No.</b></td><td><b>Balance</b></td></tr>

<tr><td>U1234567</td><td>1152.31</td></tr>

<tr><td>E1234568</td><td>276.50</td></tr>

<tr><td>G1234569</td><td>0.00</td></tr>

</table>

<input name=’U1234567′ type=’hidden’ value=’1152.31′>

<input name=’E1234568′ type=’hidden’ value=’276.50′>

<input name=’G1234569′ type=’hidden’ value=’0.00′>

</body>

 

</html>

Người gọi có thể bỏ qua tất cả các trường HTML và lấy ra các giá trị trả về từ các trường ẩn.

Để làm cho XML đầu ra API hợp lệ, bạn có thể thêm tham số tùy chọn này vào bất kỳ yêu cầu API nào được mô tả bên dưới: api_version=1.

1. Kết nối API chuyển tiền Perfect Money

API chuyển tiền tự động Perfect Money có thể được thực hiện bằng cách thực hiện một bài đăng dưới dạng HTML thuộc loại GET hoặc POST tới URL: https://perfectmoney.com/acct/confirm.asp

Nên sử dụng các trường đầu vào sau:

Input Fields for submit to
https://perfectmoney.com/acct/confirm.asp
Input Field Name Description Example Value
AccountID Perfect Money(PM) account login  (payer) 10000
PassPhrase Perfect Money(PM) account password This1isnotReal
Payer_Account Your Perfect Money(PM) account to spend from U1234567
Payee_Account Perfect Money(PM) account to spend to U7654321
Amount Amount to be spent. Must be positive numerical amount. 19.95
Memo Up to 100 characters to be placed in memo section of transaction. The memo is visible to both payer and payee. Thanks for dinner.
PAYMENT_ID Optional merchant reference number. If present, this string of up to 50 characters is placed in the transaction. Payer and/or payee may search/query account history for this value. ID-322223
code (Optional) Pass this value if only you want to use transfer protection code. If protection code is present, payee must enter this code to get money to his/her account.

Must  be alpha-numerical string of length from 1 to 20 chars.

mycode123
period (Optional) You need to pass this value if only you want to use transfer protection code.

Number of days you want your transfer with protection code to be valid. If payee does not enter protection code during this period, money will be transferred back to your account.

Must be integer value from 1 to 365 days.

3

 

Đầu ra từ trang confirm.asp sẽ bao gồm HTML với các trường biểu mẫu ẩn được nhúng để truy xuất kết quả chuyển tiền. Đó là:

Output Fields from submit to
https://perfectmoney.com/acct/confirm.asp
Output Field Name Description Example Value
ERROR Spend did not occur if this field present. Text description of error. Invalid PassPhrase.
Payee_Account_Name Name of account of payee. Actually the text payee entered in his/her “Account name” profile field. John’s shop
Payer_Account Perfect Money(PM) account of sender. U1234567
Payee_Account Perfect Money(PM) account of recipient of spend. U7654321
PAYMENT_AMOUNT Numerical amount of spend as entered. This is the same value as the Amount input field. 5.15
PAYMENT_BATCH_NUM PerfectMoney batch number generated for this transaction. Payer and/or payee may query/search account history by this number. 758094
PAYMENT_ID Optional merchant reference number. If present on input, this string of up to 50 characters is returned on output. Payer and/or payee may search/query account history for this value. ID-322223
code (Optional) This value is present only for transfers with protection code. If protection code is present, payee must enter this code to get money to his/her account.

Can  be alpha-numerical string of length from 1 to 20 chars.

mycode123
period (Optional) This value is present only for transfers with protection code. Number of days you want your transfer with protection code to be valid. If payee does not enter protection code during this period, money will be transferred back to your account.

Must be integer value from 1 to 365 days.

3

 

2. Kết nối API xem trước/xác minh chuyển tiền Perfect Money(PM)

Bản xem trước chuyển tiền của Perfect Money(PM) có thể được thực hiện bằng cách đăng một bài đăng dưới dạng HTML kiểu GET hoặc POST tới URL: https://perfectmoney.com/acct/verify.asp

Chức năng xem trước/xác minh này có thể được sử dụng để kiểm tra tính hợp lệ của khoản chuyển tiền tiềm năng trước khi thực hiện. Lưu ý rằng việc đăng lên vị trí này không thực sự thực hiện bất kỳ giao dịch chuyển tiền nào của Perfect Money(PM).

Nên sử dụng các trường đầu vào sau

Input Fields for submit to
https://perfectmoney.com/acct/verify.asp
Input Field Name Description Example Value
AccountID Perfect Money(PM) account login  (payer) 10000
PassPhrase Perfect Money(PM) account password This1isnotReal
Payer_Account Perfect Money(PM) account of sender. U1234567
Payee_Account Perfect Money(PM) account to spend to U7654321
Amount Amount to be spent. Must be positive numerical amount.. 19.95
Memo Up to 100 characters to be placed in memo section of payment. The memo is visible to both payer and payee. Thanks for dinner.
PAYMENT_ID Optional merchant reference number. If present on input, this string of up to 50 characters is returned on output. Payer and/or payee may search/query account history for this value. ID-322223
code (Optional) Pass this value if only you want to use transfer protection code. If protection code is present, payee must enter this code to get money to his/her account.

Must  be alpha-numerical string of length from 1 to 20 chars.

mycode123
period (Optional) You need to pass this value if only you want to use transfer protection code.

Number of days you want your transfer with protection code to be valid. If payee does not enter protection code during this period, money will be transferred back to your account.

Must be integer value from 1 to 365 days.

3

 

Đầu ra từ trang verify.asp sẽ bao gồm HTML với các trường biểu mẫu ẩn được nhúng để truy xuất kết quả chuyển tiền. Đó là:

Output Fields from submit to
https://perfectmoney.com/acct/verify.asp
Output Field Name Description Example Value
ERROR Verification is unsuccessful and did not occur if this field present. Text description of error. Invalid PassPhrase.
Payee_Account_Name Name of account of payee. Actually the text payee entered in his/her “Account name” profile field. John’s shop
Payer_Account Perfect Money(PM) account of sender. U1234567
Payee_Account Perfect Money(PM) account of recipient of spend. U7654321
PAYMENT_AMOUNT Numerical amount of spend as entered. This is the same value as the Amount input field. 5.15
PAYMENT_ID Optional merchant reference number. If present on input, this string of up to 50 characters is returned on output. Payer and/or payee may search/query account history for this value. ID-322223
code (Optional) This value is present only for transfers with protection code. If protection code is present, payee must enter this code to get money to his/her account.

Can  be alpha-numerical string of length from 1 to 20 chars.

mycode123
period (Optional) This value is present only for transfers with protection code. Number of days you want your transfer with protection code to be valid. If payee does not enter protection code during this period, money will be transferred back to your account.

Must be integer value from 1 to 365 days.

3

 

3. Kết nối API xác nhận mã bảo mật Perfect Money(PM)

Việc xác nhận mã bảo mật Perfect Money(PM) có thể được thực hiện bằng cách đăng một bài đăng dưới dạng HTML kiểu GET hoặc POST tới URL: https://perfectmoney.com/acct/protection.asp

Chức năng xác nhận mã bảo mật này được sử dụng để đăng ký các khoản thanh toán trước đó được gửi đến tài khoản của bạn bằng mã bảo mật.

Nên sử dụng các trường đầu vào sau:

Input Fields for submit to
https://perfectmoney.com/acct/protection.asp
Input Field Name Description Example Value
AccountID Perfect Money(PM) account login  (payer) 10000
PassPhrase Perfect Money(PM) account password This1isnotReal
batch Perfect Money(PM) batch number of transaction you want to confirm with protection code.

Must  be numerical value.

758094
code Perfect Money(PM) protection code entered by payer of this transaction.

Can  be alpha-numerical string of length from 1 to 20 chars.

somecode321

Đầu ra từ trang Protection.asp sẽ bao gồm HTML với các trường biểu mẫu ẩn được nhúng để truy xuất kết quả chuyển tiền. Đó là:

Output Fields from submit to
https://perfectmoney.com/acct/protection.asp
Output Field Name Description Example Value
ERROR Confirmation  is unsuccessful and did not occur if this field present. Text description of error. Invalid PassPhrase.
PAYMENT_BATCH_NUM Perfect Money(PM) batch number of transaction you just confirmed (enrolled) with protection code.

Numerical value.

758094
code Perfect Money(PM) protection code entered by payer of this transaction.

Can  be alpha-numerical string of length from 1 to 20 chars.

somecode321

 

4. Kết nối API tự động tìm nạp tiền theo tên tài khoản Perfect Money

API tìm nạp tên tài khoản Perfect Money(PM) có thể được thực hiện bằng cách thực hiện một bài đăng dưới dạng HTML thuộc dạng GET hoặc POST tới URL: https://perfectmoney.com/acct/acc_name.asp

Chức năng tìm nạp tiền theo tên tài khoản này được sử dụng để lấy trường hồ sơ tên tài khoản của ID tài khoản đã chuyển.

Nên sử dụng các trường đầu vào sau:

Input Fields for submit to
https://perfectmoney.com/acct/acc_name.asp
Input Field Name Description Example Value
AccountID Perfect Money(PM) account login 10000
PassPhrase Perfect Money(PM) account password This1isnotReal
Account Perfect Money(PM) account ID U1234567

Đầu ra từ trang acc_name.asp sẽ là Tên tài khoản và trạng thái Xác minh hoặc thông báo lỗi nếu không thể hoàn thành thao tác:

Description Example
Account name fetching cannot be completed if ERROR prefix present followed by text description of error. ERROR: Invalid PassPhrase.
Account name field of Account owner and Verification status. John’s shop,Verified

 

5. Kết nối API lấy lịch sử giao dịch cho Perfect Money(PM)

API lấy lịch sử giao dịch cho tài khoản Perfect Money(PM) có thể được truy xuất ở định dạng CSV (Giá trị được phân tách bằng dấu phẩy) bằng URL: https://perfectmoney.com/acct/historycsv.asp

API PM sử dụng các trường đầu vào sau:

Input Fields for submit to
https://perfectmoney.com/acct/historycsv.asp
Input Field Name(s) Description Example Value(s)
AccountID Perfect Money(PM) account login (payer) 10000
PassPhrase Perfect Money(PM) account password This1isnotReal
startmonth,
startday,
startyear
These three fields define the starting day to gather account history from. Month should be a number from 1 to 12, day should be a number from 1 to 31 and year should be a 4 digit number from 2007 onward. 12
1
2007
endmonth,
endday,
endyear
These three fields define the ending day to gather account history from. Month should be a number from 1 to 12, day should be a number from 1 to 31 and year should be a 4 digit number from 2007 onward.
History will be provided for records from the beginning of the start date fields to the end of the end date fields. For instance, the example values would retrieve one complete month of data for the month of December 2007.
12
31
2007
paymentsmade If present on input, Perfect Money(PM) payments made are included in the history display. To not include Perfect Money(PM) payments made, do not include this as an input field. 1
paymentsreceived If present on input, Perfect Money(PM) payments received are included in the history display. To not include Perfect Money(PM) payments received, do not include this as an input field. 1
batchfilter If present on input, only transactions that have this value as a batch number are displayed. 1289
counterfilter If present on input, only transactions that have this PerfectMoney account number as a counter part (payments to/from this account number) are displayed. U1234567
metalfilter If present on input, only transactions that use the given currency units are displayed. Legal values are 1, 2 and 3 corresponding to US Dollars, Euro, and Gold troy oz. 1
desc If present, sort records in descending order instead of the default ascending order. 1
oldsort If present, defines the column to sort the history transactions on. (Default is timestamp). Choices are tstamp, batch_num, metal_name, counteraccount_id and amount corresponding to the available columns returned. Amount
payment_id If present on input, only transactions that have this value as a payment_id are displayed. ID-123

Sau khi gửi tới historycsv.asp, một tập hợp dữ liệu khớp với thông tin đầu vào được yêu cầu sẽ được trả về. Báo cáo được trả về là ứng dụng ContentType/csv. Nếu không tìm thấy bản ghi nào dựa trên các tham số đầu vào, một dòng chứa:

Không có dữ liệu được tìm thấy.

Được trả lại. Ngược lại, dòng đầu tiên trả về chứa 10 tên cột:

Time,Type,Batch,Currency,Amount,Fee,Payer Account,Payee Account, Payment ID, Memo

Sau đây là mô tả chi tiết hơn về API:

Columns returned from https://perfectmoney.com/acct/historycsv.asp
ColumnName Description Example
Batch The batch number of the transaction 1289
Time Time of transaction in GMT. 09/08/2000 00:03
Type Transaction Type. Possible values are:
Charge
Income
Income
Currency Name of Perfect Money(PM)  currency transaction occurred in. Possible values are:
USD
EUR
Troy oz.
(GOLD)
BTC
(Bitcoin)
USD
Amount The actual numerical value of transaction. 19.95
Fee The amount of fee of the given transaction. 0.12
Payer Account PerfectMoney payer account ID. U1234567
Payee Account PerfectMoney payee account ID. U7654321
Payment ID The value optionally provided by merchant through PerfectMoney SCI or API interface. ID-123
Memo Memo corresponding to this transaction. Income 19.95 USD from account U1234567.  

 

6. Kết nối API lấy số dư Perfect Money(PM)

Bạn có thể truy xuất Perfect Money(PM) cho một tài khoản nhất định bằng cách đăng bài dưới dạng HTML kiểu GET hoặc POST tới URL: https://perfectmoney.com/acct/balance.asp

API PM có các trường đầu vào sau:

Input Fields for submit to
https://perfectmoney.com/acct/balance.asp
Input Field Name Description Example Value
AccountID Perfect Money(PM) account login (payer) 100079
PassPhrase Perfect Money(PM) account password This1isnotReal

 

Đầu ra từ trang Balance.asp sẽ bao gồm HTML với các trường biểu mẫu ẩn được nhúng để truy xuất thông tin số dư. Đó là:

Output Fields from submit to
https://perfectmoney.com/acct/balance.asp
Output Field Name Description Example Value
U1234567

<…>

Current available balance of the account U1234567 (where U1234567 – can be any ID of accounts you own). 1155.29
ERROR Access is unsuccessful and did not occur if this field present. Text description of error. Can’t login with passed AccountID and PassPhrase

 

7. Kết nối API tỷ giá PM

API tỷ giá PM Tỷ giá hiện tại cho các loại tiền tệ khác nhau có thể được truy xuất bằng cách đăng bài dưới dạng HTML kiểu GET hoặc POST tới URL: https://perfectmoney.com/acct/rates.asp

Nên sử dụng các trường đầu vào sau:

Input Fields for submit to
https://perfectmoney.com/acct/rates.asp
Input Field Name Description Example Value
CUR Optional input field indicating display of exchange rates in this currency. Default is US Dollars. Choices are:
USD = US Dollars
EUR = Euro
GOLD = Gold ounces (toy)
BTC = Bitcoin
EUR

Đầu ra từ trang rate.asp sẽ là một tập hợp dữ liệu ASCII được phân cách bằng dấu phẩy. Ngày/giờ này sẽ tính theo GMT và sẽ được định dạng như “Tháng/Ngày/Năm Giờ:Phút/Giây AM/PM” ví dụ: “2/6/00 9:36:45 PM” tương ứng với ngày 2 tháng 6 năm 2000 21: 36:45 GMT. Ngày/giờ sẽ được theo sau bởi hai hoặc ba giá trị (tùy thuộc vào đầu vào USD, EUR, GOLD, BTC) đưa ra tỷ giá hối đoái trên mỗi đơn vị cho loại tiền đã chọn (mặc định là Đô la Mỹ).

Ví dụ về đầu vào và đầu ra:

Example 1 “Current exchange rates for EUR & GOLD & BTC to USD”

https://perfectmoney.com/acct/rates.asp

gives:

3/13/08 6:25:05 PM, 0.98 , 0.0005, 0.000048

Cung cấp tỷ giá hối đoái Đô la Mỹ sang Euro, Vàng và Bitcoin

8 Kết nối API Perfect Money(PM) e-Voucher

Danh sách E-Voucher cho tài khoản Perfect Money(PM) có thể được truy xuất ở định dạng CSV (Giá trị được phân tách bằng dấu phẩy) bằng URL: https://perfectmoney.com/acct/evcsv.asp

Nên sử dụng các trường đầu vào sau:

Input Fields for submit to
https://perfectmoney.com/acct/evcsv.asp
Input Field Name(s) Description Example Value(s)
AccountID * Perfect Money(PM) account login (payer) 10000
PassPhrase * Perfect Money(PM) account password This1isnotReal
startmonth,
startday,
startyear
These three fields define the starting day to gather e-voucher listing from. Month should be a number from 1 to 12, day should be a number from 1 to 31 and year should be a 4 digit number from 2007 onward.

Please note this date means the date when e-voucher was created.

12
1
2007
endmonth,
endday,
endyear
These three fields define the ending day to gather e-voucher listing from. Month should be a number from 1 to 12, day should be a number from 1 to 31 and year should be a 4 digit number from 2007 onward.
Listing will be provided for e-vouchers from the beginning of the start date fields to the end of the end date fields. For instance, the example values would retrieve one complete month of data for the month of December 2007.
12
31
2007
ev_number If present on input, only Perfect Money(PM) e-Voucher with that number is included in the listing  display. 0123456789
batchfilter If present on input, only e-Voucher that have this value as a batch number is displayed. 1289
counterfilter If present on input, only e-Vouchers that have this PerfectMoney account as a counter part (payments to/from this account number) are displayed. U1234567
currency If present on input, only e-Vouchers that use the given currency units are displayed. Legal values are 1, 2 and 3 corresponding to US Dollars, Euro, and Gold troy oz. 1
desc If present, sort records in descending order instead of the default ascending order. 1
oldsort If present, defines the column to sort the e-Vouvher listing  on. (Default is created). Choices are created, amount, currency and batch corresponding to the available columns returned. amount

 

* Chú Ý: Các trường được đánh dấu sao là bắt buộc. Các trường khác là tùy chọn.

Sau khi gửi tới evcsv.asp, một tập hợp dữ liệu khớp với thông tin đầu vào được yêu cầu sẽ được trả về. Báo cáo được trả về là ứng dụng ContentType/csv. Nếu không tìm thấy bản ghi nào dựa trên các tham số đầu vào, một dòng chứa:

Không có dữ liệu được tìm thấy.

Được trả lại. Ngược lại, dòng đầu tiên trả về chứa 9 tên cột:

Created,e-Voucher number,Activation code,Currency,Batch,Payer Account,Payee Account,Activated,Amount

Sau đây là mô tả chi tiết hơn về từng mục này:

Columns returned from https://perfectmoney.com/acct/evcsv.asp
ColumnName Description Example
Created Time of e-Voucher creation in GMT. 09/08/2000 00:03
e-Voucher number The number of the e-Voucher (contains 10 digits) 0123456789
Activation code The activation code of the e-Voucher (contains 16 digits) 0123456789012345
Currency Name of Perfect Money(PM)  e-Voucher c occurred in. Possible values are:
USD
EUR
Troy oz.
(GOLD)
BTC
(Bitcoin)
USD
Batch The batch number of the e-Voucher creation transaction 1289
Payer Account PerfectMoney payer account ID (e-Voucher creator). U1234567
Payee Account PerfectMoney payee account ID (e-Voucher activator).  If e-Voucher is not activated – empty value. U7654321
Activated Time of e-Voucher activation in GMT. If e-Voucher is not activated – empty value. 09/08/2000 00:03
Amount The actual nominal value of e-Voucher. 19.95

 

9. API tạo Perfect Money(PM) e-Voucher

Việc tạo Perfect Money(PM) e-Voucher có thể được thực hiện bằng cách đăng một bài đăng dưới dạng HTML kiểu GET hoặc POST tới URL: https://perfectmoney.com/acct/ev_create.asp

Nên sử dụng các trường đầu vào sau:

Input Fields for submit to
https://perfectmoney.com/acct/ev_create.asp
Input Field Name Description Example Value
AccountID Perfect Money(PM) account login  (payer) 10000
PassPhrase Perfect Money(PM) account password This1isnotReal
Payer_Account Your Perfect Money(PM) account to spend from U1234567
Amount Amount to be spent. Must be positive numerical amount.

As a result e-Voucher of this nominal will be created.

19.95

 

Đầu ra từ trang ev_create.asp sẽ bao gồm HTML với các trường biểu mẫu ẩn được nhúng để truy xuất kết quả chuyển tiền. Đó là:

Output Fields from submit to
https://perfectmoney.com/acct/ev_create.asp
Output Field Name Description Example Value
ERROR e-Voucher was not created if this field present. Text description of error. Invalid PassPhrase.
Payer_Account Perfect Money(PM) account of e-Voucher buyer. U1234567
PAYMENT_AMOUNT Numerical amount of spend as entered. This is the total amount you payed icluding fee. 20.05
PAYMENT_BATCH_NUM PerfectMoney batch number generated for this transaction. You may query/search account history by this number. 758094
VOUCHER_NUM Unique number of purchased e-Voucher contaning 10 digits. 01234567891
VOUCHER_CODE Activation code of purchased e-Voucher contaning 16 digits. 0123456789123456
VOUCHER_AMOUNT Nominal amount of e-Voucher. This is the same value as the Amount input field. 19.95

 

10. API hoàn trả Perfect Money(PM) e-Voucher

Việc hoàn trả Perfect Money(PM) e-Voucher có thể được thực hiện bằng cách đăng một bài đăng dưới dạng HTML kiểu GET hoặc POST tới URL: https://perfectmoney.com/acct/ev_remove.asp

Nên sử dụng các trường đầu vào sau:

Input Fields for submit to
https://perfectmoney.com/acct/ev_remove.asp
Input Field Name Description Example Value
AccountID Perfect Money(PM) account login  (buyer) 10000
PassPhrase Perfect Money(PM) account password This1isnotReal
ev_number Your Perfect Money(PM) e-Voucher unique number you want to return.

In case of success you will get e-Voucher nominal amount back to account you used to create this e-Voucher.

01234567891

Đầu ra từ trang ev_remove.asp sẽ bao gồm HTML với các trường biểu mẫu ẩn được nhúng để truy xuất kết quả chuyển tiền. Đó là:

Output Fields from submit to
https://perfectmoney.com/acct/ev_remove.asp
Output Field Name Description Example Value
ERROR e-Voucher was not returned if this field present. Text description of error. Invalid PassPhrase.
VOUCHER_NUM Unique number of returned e-Voucher contaning 10 digits. 01234567891
VOUCHER_AMOUNT Nominal amount of e-Voucher.

Also amount that was credited back to your account.

19.95
Payer_Account Perfect Money(PM) account of e-Voucher buyer. U1234567
PAYMENT_BATCH_NUM PerfectMoney batch number generated for this transaction. You may query/search account history by this number. 758094

 

11. Kích hoạt Perfect Money(PM) Voucher

Việc kích hoạt Perfect Money(PM) Voucher có thể được thực hiện bằng cách đăng một bài đăng dưới dạng HTML kiểu GET hoặc POST tới URL: https://perfectmoney.com/acct/ev_activate.asp

Nên sử dụng các trường đầu vào sau:

Input Fields for submit to
https://perfectmoney.com/acct/ev_activate.asp
Input Field Name Description Example Value
AccountID Perfect Money(PM) account login  (payer) 10000
PassPhrase Perfect Money(PM) account password This1isnotReal
Payee_Account Perfect Money(PM) account to activate e-Voucher to.

e-Voucher nominal amount was credited to this account.

U1234567
ev_number Your Perfect Money(PM) e-Voucher unique number you want to activate. 01234567891
ev_code Activation code of e-Voucher. 0123456789123456

Đầu ra từ trang ev_activate.asp sẽ bao gồm HTML với các trường biểu mẫu ẩn được nhúng để truy xuất kết quả chuyển tiền. Đó là:

Output Fields from submit to
https://perfectmoney.com/acct/ev_activate.asp
Output Field Name Description Example Value
ERROR e-Voucher was not activated if this field present. Text description of error. Invalid PassPhrase.
VOUCHER_NUM Unique number of activated e-Voucher contaning 10 digits. 01234567891
VOUCHER_AMOUNT Nominal amount of e-Voucher.

This amount was credited to Payee_Account.

19.95
VOUCHER_AMOUNT_CURRENCY Currency of amount. Possible values are:

1 – USD

2 – EUR

3 – GOLD

7  – BTC

19.95
Payee_Account Perfect Money(PM) account of e-Voucher payee. U1234567
PAYMENT_BATCH_NUM PerfectMoney batch number generated for this transaction. You may query/search account history by this number. 758094

 

Một số đoạn code mẫu

1. PHP script để truy xuất API lịch sử tài khoản Perfect Money

<?php

 

/*

 

This script demonstrates querying account history

using PerfectMoney API interface.

 

*/

 

// trying to open URL

$f=fopen(‘https://perfectmoney.com/acct/historycsv.asp?startmonth=1&startday=1&startyear=2007&endmonth=1&endday=27&endyear=2008&AccountID=myaccount&PassPhrase=mypassword’, ‘rb’);

 

if($f===false){

echo ‘error openning url’;

}

 

// getting data to array (line per item)

$lines=array();

while(!feof($f)) array_push($lines, trim(fgets($f)));

 

fclose($f);

 

$ar=array();

// try parsing data to array

if($lines[0]!=’Time,Type,Batch,Currency,Amount,Fee,Payer Account,Payee Account,Payment ID,Memo’){

// print error message

echo $lines[0];

}else{

// do parsing

$n=count($lines);

for($i=1; $i<$n; $i++){

 

$item=explode(“,”, $lines[$i], 10);

if(count($item)!=10) continue; // line is invalid – pass to next one

$item_named[‘Time’]=$item[0];

$item_named[‘Type’]=$item[1];

$item_named[‘Batch’]=$item[2];

$item_named[‘Currency’]=$item[3];

$item_named[‘Amount’]=$item[4];

$item_named[‘Fee’]=$item[5];

$item_named[‘Payer Account’]=$item[6];

$item_named[‘Payee Account’]=$item[7];

$item_named[‘Payment ID’]=$item[8];

$item_named[‘Memo’]=$item[9];

array_push($ar, $item_named);

}

 

}

 

echo ‘<pre>’;

print_r($ar);

echo ‘</pre>’;

 

?>

 

2. PHP script để truy xuất API xem trước Perfect Money

<?php

 

/*

 

This script demonstrates transfer proccess between two

PerfectMoney accounts using PerfectMoney API interface.

 

*/

 

// trying to open URL to process PerfectMoney Spend request

$f=fopen(‘https://perfectmoney.com/acct/confirm.asp?AccountID=myaccount&PassPhrase=mypassword&Payer_Account=U987654&Payee_Account=U1234567&Amount=1&PAY_IN=1&PAYMENT_ID=1223’, ‘rb’);

 

if($f===false){

echo ‘error openning url’;

}

 

// getting data

$out=array(); $out=””;

while(!feof($f)) $out.=fgets($f);

 

fclose($f);

 

// searching for hidden fields

if(!preg_match_all(“/<input name='(.*)’ type=’hidden’ value='(.*)’>/”, $out, $result, PREG_SET_ORDER)){

echo ‘Ivalid output’;

exit;

}

 

$ar=””;

foreach($result as $item){

$key=$item[1];

$ar[$key]=$item[2];

}

 

echo ‘<pre>’;

print_r($ar);

echo ‘</pre>’;

 

?>

 

3. PHP script truy xuất API tên tài khoản Perfect Money

<?php

 

/*

 

This script demonstrates fetching account name by account ID

using PerfectMoney API interface.

 

*/

 

// trying to open URL to process PerfectMoney account name fetching

$f=fopen(‘https://perfectmoney.com/acct/acc_name.asp?AccountID=myaccount&PassPhrase=mypassword&Account=U987654’, ‘rb’);

 

if($f===false){

echo ‘error openning url’;

}

 

// getting data

$out=””;

while(!feof($f)) $out.=fgets($f);

 

fclose($f);

 

 

echo ‘<pre>’;

echo $out;

echo ‘</pre>’;

 

?>

 

4. PHP  script hiển thị API Perfect Money® số dư

<?php

 

/*

 

This script demonstrates querying account balance

using PerfectMoney API interface.

 

*/

 

// trying to open URL to process PerfectMoney Spend request

$f=fopen(‘https://perfectmoney.com/acct/balance.asp?AccountID=myaccount&PassPhrase=mypassword’, ‘rb’);

 

if($f===false){

echo ‘error openning url’;

}

 

// getting data

$out=array(); $out=””;

while(!feof($f)) $out.=fgets($f);

 

fclose($f);

 

// searching for hidden fields

if(!preg_match_all(“/<input name='(.*)’ type=’hidden’ value='(.*)’>/”, $out, $result, PREG_SET_ORDER)){

echo ‘Ivalid output’;

exit;

}

 

// putting data to array

$ar=””;

foreach($result as $item){

$key=$item[1];

$ar[$key]=$item[2];

}

 

echo ‘<pre>’;

print_r($ar);

echo ‘</pre>’;

 

?>

 

5. PHP script để truy xuất Perfect Money® e-Voucher

<?php

 

/*

 

This script demonstrates getting complete listing

of all e-Vouchers created by the Perfect Money user.

 

*/

 

// trying to open URL

$f=fopen(‘https://perfectmoney.com/acct/evcsv.asp?AccountID=myaccount&PassPhrase=mypassword’, ‘rb’);

 

if($f===false){

echo ‘error openning url’;

}

 

// getting data to array (line per item)

$lines=array();

while(!feof($f)) array_push($lines, trim(fgets($f)));

 

fclose($f);

 

// try parsing data to array

if($lines[0]!=’Created,e-Voucher number,Activation code,Currency,Batch,Payer Account,Payee Account,Activated,Amount’){

 

// print error message

echo $lines[0];

 

}else{

 

// do parsing

$ar=array();

$n=count($lines);

for($i=1; $i<$n; $i++){

 

$item=explode(“,”, $lines[$i], 9);

if(count($item)!=9) continue; // line is invalid – pass to next one

$item_named[‘Created’]=$item[0];

$item_named[‘Number’]=$item[1];

$item_named[‘Code’]=$item[2];

$item_named[‘Currency’]=$item[3];

$item_named[‘Batch’]=$item[4];

$item_named[‘Payer Account’]=$item[5];

$item_named[‘Payee Account’]=$item[6];

$item_named[‘Activated’]=$item[7];

$item_named[‘Amount’]=$item[8];

array_push($ar, $item_named);

}

 

}

 

echo ‘<pre>’;

print_r($ar);

echo ‘</pre>’;

 

?>

 

6. PHP script để tạo API Perfect Money® e-Voucher

<?php

 

/*

 

This is a sample script, that demonstrates sending

PerfectMoney e-Voucher purchase request and parsing

output data to array.

 

*/

 

// trying to open URL to process PerfectMoney e-Voucher creation

$f=fopen(‘https://perfectmoney.com/acct/ev_create.asp?AccountID=myaccount&PassPhrase=mypassword&Payer_Account=U987654&Amount=0.01’, ‘rb’);

 

if($f===false){

echo ‘error openning url’;

}

 

// getting data

$out=array(); $out=””;

while(!feof($f)) $out.=fgets($f);

 

fclose($f);

 

// searching for hidden fields

if(!preg_match_all(“/<input name='(.*)’ type=’hidden’ value='(.*)’>/”, $out, $result, PREG_SET_ORDER)){

echo ‘Ivalid output’;

exit;

}

 

$ar=””;

foreach($result as $item){

$key=$item[1];

$ar[$key]=$item[2];

}

 

echo ‘<pre>’;

print_r($ar);

echo ‘</pre>’;

 

?>

 

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *