nattreid/stripe-api
Composer 安装命令:
composer require nattreid/stripe-api
包简介
Stripe API for Nette Framework
README 文档
README
Nastavení v config.neon
extensions: stripeApi: NAttreid\StripeApi\DI\StripeApiExtension stripeApi: publishableApiKey: xxxXXXxXXXXxxxx
Použití
/** @var \NAttreid\StripeApi\Control\IPayButtonFactory @inject */ public $payButtonFactory; /** @var \NAttreid\StripeApi\Control\IPaymentFactory @inject */ public $paymentFactory; /** @var \NAttreid\StripeApi\Control\IMasterPassButtonFactory @inject */ public $masterpassFactory; /** @var \NAttreid\StripeApi\Control\ICardElementFactory @inject */ public $cardElementFactory; /** @var \NAttreid\StripeApi\Control\ICardPaymentFactory @inject */ public $cardPaymentFactory; protected function createComponentButton() { $control = $this->payButtonFactory->create(); $payment = new \NAttreid\StripeApi\Helpers\Payments\PaymentRequest(); $payment->setCurrency('usd'); $payment->setCountry('US'); $payment->setPrice(1000); $control->setPayment($payment); $control->setOnlyApplePay(); # platby pouze apple pay $control->setOnlyPaymentRequest(); # pouze ostatni platby, krome apple pay $control->setUnsupported('Nepodporuje'); # text nepodporovane platby v prohlizeci $control->setSuccessUrl('/success'); $control->setErrorUrl('/error'); $control->onSuccess[] = function ($charge) { }; $control->onError[] = function (\Exception $exception) { }; return $control; } protected function createComponentPayment() { $control = $this->paymentFactory->create(); $payment = new \NAttreid\StripeApi\Helpers\Payments\Giropay(); $payment->setCurrency('eur'); $payment->setOrderId(5555); $payment->setOwner('Testing Name'); $payment->setPrice(200); $control->setPayment($payment); $control->setSuccessUrl('/success'); $control->setErrorUrl('/error'); $control->onSuccess[] = function ($charge) { }; $control->onError[] = function (\Exception $exception) { }; return $control; } protected function createComponentMasterpass() { $control = $this->masterpassFactory->create(); $payment = new \NAttreid\StripeApi\Helpers\Payments\Masterpass(); $payment->setCurrency('eur'); $payment->setCartId('xxXXXxXXxXXXXxx'); $payment->setPrice(200); $control->setPayment($payment); $control->setSuccessUrl('/success'); $control->setErrorUrl('/error'); $control->onSuccess[] = function ($charge) { }; $control->onError[] = function (\Exception $exception) { }; return $control; } protected function createComponentCardElement() { $control = $this->cardElementFactory->create(); $payment = new \NAttreid\StripeApi\Helpers\Payments\Card(); $payment->setCurrency('eur'); $payment->setPrice(200); $control->setPayment($payment); $control->setSuccessUrl('/success'); $control->setErrorUrl('/error'); $control->onSuccess[] = function ($charge) { }; $control->onError[] = function (\Exception $exception) { }; return $control; } protected function createComponentCardPayment() { $control = $this->cardElementFactory->create(); $control->setTitle('Payment'); $control->setLocale('auto'); $control->setAllowRemember(true); $payment = new \NAttreid\StripeApi\Helpers\Payments\Card(); $payment->setCurrency('eur'); $payment->setPrice(200); $payment->setEmail('test@test.com); $control->setPayment($payment); $control->setSuccessUrl('/success'); $control->setErrorUrl('/error'); $control->onSuccess[] = function ($charge) { }; $control->onError[] = function (\Exception $exception) { }; return $control; }
{control button} {control payment} {control masterpass} {control cardPayment, 'Pay with Card'} {control cardElement, 'Submit Payment', [class => button]}
统计信息
- 总下载量: 41
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-02-05