PHP code example of lamine-minato / orange-money-gateway
1. Go to this page and download the library: Download lamine-minato/orange-money-gateway library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lamine-minato / orange-money-gateway example snippets
$action = new OrangeMoneyAction(...);
$config = new OrangeMoneyConfig(
tokenUrl: "https://api.orange.com/oauth/v3/token",
proccessUrl: "https://api.orange.com/orange-money-webpay/ml/v1/webpayment",
)
#[Route('/payment/notif', name: 'payment_notification', methods: ['POST'])]
public function paymentNotification(Request $request): JsonResponse
{
$payload = $request->toArray();
$webhookResponse = OrangeMoneyGateway::handleWebhook($payload);
if ($webhookResponse->isSuccess()) {
// Update your order status to PAID
// $webhookResponse->getNotifToken()
// $webhookResponse->getTransactionId()
} elseif ($webhookResponse->isFailed()) {
// Update your order status to FAILED
}
return new JsonResponse(['status' => 'ok']);
}