wdwp/yandexmoney

PHP library for Yandex money forms and buttons api

v1.0 2018-01-16 09:24 UTC

This package is not auto-updated.

Last update: 2025-06-22 08:39:08 UTC


README

Installation

Install this package through Composer. To your composer.json file, add:

{
    "require": {
        "wdwp/yandexmoney": "^1.0"
    }
}

Examples

Create payment:

use wdwp\yandexmoney\Payment;

$payment = new Payment(
    '4100163332366', 'Payment', 100.0, 'shop', 'AC'
);

$form = $payment->setFormcomment('Shop name')
    ->setDest('Payment for some goods')
    ->setLabel($order->id)
    ->setComment($order->comment)
    ->setSuccessUrl('http://yoursite.com/success.php')
    ->needFio(true)
    ->needEmail(true)
    ->needPhone(true)
    ->needAddress(true)
    ->getForm();

echo $form;

// redirect to payment url
$payment->send();

// get payment url
$url = $payment->getUrl();

Check payment result:

// somewere in result url handler...
...
use wdwp\yandexmoney\Payment;

$result = Payment::validate($_POST, 'RX29rXHxOsR0exsBs6Hvi'); //secret word

if ($result) {
    // payment is valid
    $order = Orders::find($result['label']);      
   
}
...

Success page:

...
echo "Thank you for your payment!";
...