Wallet Download 9.6

This component/theme works with latest OSSN version.
5.0
Indonesian Arsalan Shah 4 years ago

A general-purpose wallet system for users, allowing them to add balance to their account. The site administrator can utilize the user's wallet balance through a set of available APIs.

  • Supported Payment Method: PayPal/Stripe/Iyzipay
  • Minimum Deposit: The minimum allowed deposit is 10.
  • Currency: The default currency is USD (editable in ossn_com.php).
  • Amount Format: Amount example 10, 20, 10.5, 5.50 etc

🔐 Seamless Payments (Stripe Only)

Wallet now supports seamless payments, allowing users to securely save their card for future charges. This feature is only available when Stripe is configured as the payment gateway. The card is blocked after 3 failed attempts and admin need to delete card before user can add same card or new card. Make sure you disable Stripe Link integration https://support.stripe.com/questions/how-to-turn-off-link

📧 Transaction Notifications

Users receive email notifications for every credit or debit transaction, including both successful and failed attempts.

⚙️ Configuration Constants

Tax collection is possible in settings only if you have configured to card stripe, and configured tax in stripe.

define('WALLET_CURRENCY_CODE', 'USD');         // Your 3-letter currency code (e.g., USD)
define('WALLET_MINIMUM_LOAD', 10);             // Minimum wallet load (integer only)
define('WALLET_SEAMLESS_CHARGE', 1);           // Minimum charge to store card for seamless payments

API ENDPOINTS

➖ Debit

CURL https://www.yourwebsite.com/api/v1.0/wallet/debit

➕ Credit

CURL https://www.yourwebsite.com/api/v1.0/wallet/credit

📥 Parameters & Responses

Parameter Type Description Required
api_key_token string Your API token Yes
guid integer User GUID Yes
amount float/integer Amount to debit or credit Yes
description string Transaction description Yes

✅ Sample JSON Response

{
  "merchant": "Open Source Social Network",
  "url": "https:\/\/yourwebsite.com\/",
  "time_token": 1637513403,
  "payload": {
    "status": "success",
    "amount": "50",
    "guid": "1"
  },
  "code": "100",
  "message": "Request successfully executed"
}

🧩 Access Using PHP

<?php
// Credit wallet
try {
    $user_guid = ossn_loggedin_user()->guid;
    $wallet = new Wallet\Wallet($user_guid);
    $amount = 20;
    $description = 'Some description';
    var_dump($wallet->credit($amount, $description));
} catch (Wallet\NoUserException $e) {
    echo $e->getMessage();
} catch (Wallet\CreditException $e) {
    echo $e->getMessage();
}

// Debit wallet
try {
    $user_guid = ossn_loggedin_user()->guid;
    $wallet = new Wallet\Wallet($user_guid);
    $amount = 20;
    $description = 'Some description';
    var_dump($wallet->debit($amount, $description));
} catch (Wallet\NoUserException $e) {
    echo $e->getMessage();
} catch (Wallet\DebitException $e) {
    echo $e->getMessage();
}

// Get wallet balance
$user_guid = ossn_loggedin_user()->guid;
$wallet = new Wallet\Wallet($user_guid);
echo $wallet->getBalance();

// Set new balance
$user_guid = ossn_loggedin_user()->guid;
$wallet = new Wallet\Wallet($user_guid);
echo $wallet->setBalance(<new amount>);

9.0

  • Updated API
  • Allow you to configure tax compliance if using card stripe

4.0

  • Allow seamless payments so if wallet balance is insufficient it charge card automatically if saved.

Image

Comments
Indonesian Arsalan Shah Replied 1 year ago

The ticket closed the problem is in your code not in wallet itself.

Please open a new discussion thread above.

Also follow what Michael said and provide the correct details mentioned on the how to report error.

us Mizhack Aguilar Replied 1 year ago

I just did submit the issue to Github. I also asked for any suggestions to incorporate the real exchange rate conversion of the amount issued/paid/received.

us Mizhack Aguilar Replied 1 year ago

So, the member here is one of our business people. We are trying to populate the members area before we become live.
So, any idea or suggestion for my conversion code integration, to make it work? I would appreciate it.

us Mizhack Aguilar Replied 1 year ago

Hi Michael
Thank you for your quick response. Our website is still underdevelopment mode. We are making some minor changes that would cater our business goal. When I checked the specific member area issue in wallet. I did not pay for any subscription fee. The wallet component is free right? So, we were just making some changes to this by adding a real exchange rate from a company that we subscribed to.
The system did some self-repair. However, it did not go back to the normal view of the wallet overview. enter image description here We

German Michael Zülsdorff Replied 1 year ago

It told the member to wait to get it refresh.

Please provide a screenshot.
See https://www.opensource-socialnetwork.org/wiki/view/1101/how-to-report-a-bug-error-issue
and put your complete code on Github.

And: Which pricing plan did you subscribe to?

us Mizhack Aguilar Replied 1 year ago

This is a great component. I hope to add a live conversion of the USD currency to other currencies. using an API key.. I have this code, but it gives me an error for several try after integrating the code within the wallet overview.php.
Here's the code that I have:
<?php
// Replace with your actual API key
$apiKey = 'YOUR_API_KEY';

// Function to get exchange rates from CurrencyLayer API
function getExchangeRates($apiKey) {
$url = "https://api.currencylayer.com/live?access_key={$apiKey}";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}

// Function to convert USD to another currency
function convertCurrency($amount, $toCurrency, $exchangeRates) {
if (array_key_exists($toCurrency, $exchangeRates['quotes'])) {
return $amount * $exchangeRates['quotes'][$toCurrency];
} else {
return "Currency not supported.";
}
}

// Example usage
$exchangeRates = getExchangeRates($apiKey);
$amountInUSD = 100; // Amount in USD

echo "Amount in PHP: " . convertCurrency($amountInUSD, 'PHP', $exchangeRates) . "\n";
echo "Amount in MXN: " . convertCurrency($amountInUSD, 'MXN', $exchangeRates) . "\n";
echo "Amount in EUR: " . convertCurrency($amountInUSD, 'EUR', $exchangeRates) . "\n";
echo "Amount in GBP: " . convertCurrency($amountInUSD, 'GBP', $exchangeRates) . "\n";
echo "Amount in ILS: " . convertCurrency($amountInUSD, 'ILS', $exchangeRates) . "\n";
echo "Amount in SAR: " . convertCurrency($amountInUSD, 'SAR', $exchangeRates) . "\n";
echo "Amount in JPY: " . convertCurrency($amountInUSD, 'JPY', $exchangeRates) . "\n";
?>

us Mizhack Aguilar Replied 1 year ago

Hi, I am getting an error with the wallet. I did a manual balance change for a try. The member's wallet page is messed. It showed an error to the member's page only. It told the member to wait to get it refresh. but it's been over 8 hours now.

us John Robertson Replied 2 years ago

cash app api would be nice

il Roman Abramovich Replied 2 years ago

Can you add other options for working with credit cards besides Stripe?

Indonesian Arsalan Shah Replied 2 years ago

You need to use a gateway like stripe or paypal to process any cards. You can not process any cards without any gateway.