Treasury API Third Party PHP Package
using Treasury API v2.2, please make sure Treasury API version you gonna use and read API procedure below for flow of registration and transaction.
Install package with composer by following command:
composer require ryuamy/trs-emas-php
Add following code on your project:
use Ryuamy\TrsEmas;
TrsEmas\Class::function( $productionFlag, $bodyParameters, $token );
Parameters detail:
Look at example to see parameter requirement on each class.
$bodyParameters = [
'client_id' => '(Treasury client id)',
'client_secret' => '(Treasury client secret)',
];
$Tresury = TrsEmas\Authentication::loginClient( true, $bodyParameters );
$bodyParameters = [
'name' => 'Ryu Amy',
'email' => 'ryuamy.mail@gmail.com',
'password' => '(My Password)',
'password_confirmation' => '(My Password)',
'gender' => 'female',
'birthday' => '1991-01-01',
'referral_code' => '',
'phone' => '081312345678',
'security_question' => 'KQxz9YXazA14VEO',
'security_question_answer' => 'Sebastian Michaelis',
'selfie_scan' => '/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQ...',
'id_card_scan' => '/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQ...',
'owner_name' => 'Ryu Amy',
'account_number' => '123456',
'bank_code' => 'string',
'branch' => 'Jakarta',
'customer_concern' => false
];
$Tresury = TrsEmas\Authentication::register( true, $bodyParameters, '(Bearer Token)' );
Notes:
$bodyParameters = [
'client_id' => '(Treasury client id)',
'client_secret' => '(Treasury client secret)',
'email' => 'ryuamy.mail@gmail.com',
'password' => '(My Password)',
];
$Tresury = TrsEmas\Authentication::login( true, $bodyParameters );
$bodyParameters = [
'start_date' => '2021-03-03 09:00:00',
'end_date' => '2021-03-03 10:00:00'
];
$Tresury = TrsEmas\Transaction::goldRate( true, $bodyParameters, '(Bearer Token)' );
$bodyParameters = [
'amount_type' => 'currency',
'amount' => 400000,
'payment_method' => 'bca',
];
$Tresury = TrsEmas\Transaction::calculateBuy( true, $bodyParameters, '(Bearer Token)' );
$bodyParameters = [
'amount_type' => 'gold',
'amount' => 0.582,
'payment_method' => 'bca',
];
$Tresury = TrsEmas\Transaction::calculateBuy( true, $bodyParameters, '(Bearer Token)' );
$bodyParameters = [
'amount_type' => 'currency',
'amount' => 50000,
];
$Tresury = TrsEmas\Transaction::calculateSell( true, $bodyParameters, '(Bearer Token)' );
$bodyParameters = [
'amount_type' => 'gold',
'amount' => 0.015,
];
$Tresury = TrsEmas\Transaction::calculateSell( true, $bodyParameters, '(Bearer Token)' );
$bodyParameters = [
'amount_type' => 'currency',
'amount' => 400000,
];
$Tresury = TrsEmas\Transaction::calculateBuyPartner( true, $bodyParameters, '(Bearer Token)' );
$bodyParameters = [
'amount_type' => 'gold',
'amount' => 0.582,
];
$Tresury = TrsEmas\Transaction::calculateBuyPartner( true, $bodyParameters, '(Bearer Token)' );
$bodyParameters = [
'amount_type' => 'currency',
'amount' => 50000,
];
$Tresury = TrsEmas\Transaction::calculateSellPartner( true, $bodyParameters, '(Bearer Token)' );
$bodyParameters = [
'amount_type' => 'gold',
'amount' => 0.015,
];
$Tresury = TrsEmas\Transaction::calculateSellPartner( true, $bodyParameters, '(Bearer Token)' );
$Tresury = TrsEmas\Transaction::paymentMethod( true, '(Bearer Token)' );
$bodyParameters = [
'unit' => 1.8766253,
'total' => 796169,
'payment_channel' => 'BRIN',
'latitude' => '-6.914744',
'longitude' => '107.609810'
];
$Tresury = TrsEmas\Transaction::buy( true, $bodyParameters, '(Bearer Token)' );
$bodyParameters = [
'invoice_number' => 'TRS42154451',
'unit' => 1.8766253,
'total' => 796169,
'payment_channel' => 'BRIN',
'latitude' => '-6.914744',
'longitude' => '107.609810'
];
$Tresury = TrsEmas\Transaction::buyPartner( true, $bodyParameters, '(Bearer Token)' );
$bodyParameters = [
'code' => 'TRSVCR1',
];
$Tresury = TrsEmas\Transaction::applyVoucher( true, $bodyParameters, '(Bearer Token)' );
$bodyParameters = [
'invoice_number' => 'TRS42154451',
'payment_note' => 'Payment to BRI'
];
$Tresury = TrsEmas\Transaction::paymentNotify( true, $bodyParameters, '(Bearer Token)' );
$bodyParameters = [
'total' => 31587,
'unit' => 0.0432,
'latitude' => '-6.914744',
'longitude' => '107.609810'
];
$Tresury = TrsEmas\Transaction::sell( true, $bodyParameters, '(Bearer Token)' );
$Tresury = TrsEmas\Minting::mintingPartner( true, '(Bearer Token)' );
$bodyParameters = [
'minting_partner' => 'x6A3lOoJXL59zDd'
];
$Tresury = TrsEmas\Minting::mintingFee( true, $bodyParameters, '(Bearer Token)' );
Notes:
$bodyParameters = [
'minting_partner' => 'x6A3lOoJXL59zDd'
];
$Tresury = TrsEmas\Minting::mintingPiece( true, $bodyParameters, '(Bearer Token)' );
Notes:
$bodyParameters = [
'minting_partner' => 'x6A3lOoJXL59zDd'
];
$Tresury = TrsEmas\Minting::mintingShipping( true, $bodyParameters, '(Bearer Token)' );
Notes:
$bodyParameters = [
'minting_partner' => 'x6A3lOoJXL59zDd',
'minting_fee' => 'JGYPjrXW7XDw2mE',
'minting_piece' => 'KQxz9YXazA14VEO',
'minting_shipping' => '7Jb1VXLrzpm69xv'
];
$Tresury = TrsEmas\Minting::calculateMinting( true, $bodyParameters, '(Bearer Token)' );
Notes:
$bodyParameters = [
'minting_partner' => 'x6A3lOoJXL59zDd',
'minting_fee' => 'JGYPjrXW7XDw2mE',
'minting_piece' => 'KQxz9YXazA14VEO',
'minting_shipping' => '7Jb1VXLrzpm69xv',
'shipping_address' => 'Jalan Prapanca, Jakarta Selatan',
'payment_channel' => 'BRIN',
'latitude' => '-6.914744',
'longitude' => '107.609810',
];
$Tresury = TrsEmas\Minting::goldMinting( true, $bodyParameters, '(Bearer Token)' );
$bodyParameters = [
'minting_partner' => 'x6A3lOoJXL59zDd',
'minting_fee' => 'JGYPjrXW7XDw2mE',
'minting_piece' => 'KQxz9YXazA14VEO',
'minting_shipping' => '7Jb1VXLrzpm69xv',
'shipping_address' => 'Jalan Prapanca, Jakarta Selatan',
'payment_channel' => 'BRIN',
'latitude' => '-6.914744',
'longitude' => '107.609810',
];
$Tresury = TrsEmas\Minting::goldMintingPartner( true, $bodyParameters, '(Bearer Token)' );
$Tresury = TrsEmas\User::profile( true, '(Bearer Token)' );
only get Treasury update profile URL
$Tresury = TrsEmas\User::updateProfile( true, '(Bearer Token)' );
$bodyParameters = [
'email' => 'ryuamy.mail@gmail.com',
'password' => '(New Password)',
'password_confirmation' => '(New Password)',
'pin' => '12345',
];
$Tresury = TrsEmas\User::updatePassword( true, $bodyParameters, '(Bearer Token)' );
$Tresury = TrsEmas\History::buyGoldHistory( true, '(Bearer Token)' );
$Tresury = TrsEmas\History::sellGoldHistory( true, '(Bearer Token)' );
$Tresury = TrsEmas\History::goldMintingHistory( true, '(Bearer Token)' );
$bodyParameters = [
'invoice_no' => 'TRS42154451',
];
$Tresury = TrsEmas\History::buyGoldDetailHistory( true, $bodyParameters, '(Bearer Token)' );
$bodyParameters = [
'invoice_no' => 'TRS42154451',
];
$Tresury = TrsEmas\History::sellGoldDetailHistory( true, $bodyParameters, '(Bearer Token)' );
$bodyParameters = [
'invoice_no' => 'TRS42154451',
];
$Tresury = TrsEmas\History::goldMintingDetailHistory( true, $bodyParameters, '(Bearer Token)' );
$bodyParameters = [
'email' => 'ryuamy.mail@gmail.com',
];
$Tresury = TrsEmas\Additional::checkEmailAvailability( true, $bodyParameters );
$Tresury = TrsEmas\Additional::securityQuestion( true );
$Tresury = TrsEmas\Additional::bankList( true );
To create gold transaction with partner payment method, the following procedure is: