定制 aamroni/paypal 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

aamroni/paypal

最新稳定版本:1.0.0

Composer 安装命令:

composer require aamroni/paypal

包简介

PayPal API Payment in Laravel

README 文档

README

Laravel Logo

Install

composer require aamroni/paypal

Config Example

Collect your public and secret keys, and configure as necessary in config/payment.php

'paypal' => [
    'client'        => env('PAYPAL_CLIENT_KEY'),
    'secret'        => env('PAYPAL_SECRET_KEY'),
    'redirect'      => [
        'success'   => sprintf('%s/paypal/success', env('APP_URL')),
        'cancel'    => sprintf('%s/paypal/cancel', env('APP_URL')),
    ],
    'currency'      => 'USD',
    'tax_rate'      => 0,
    'insurance'     => 0,
    'additional'    => 0,
    'shipping'      => [
        'discount'  => 0,
        'netPrice'  => 0
    ]
],

Checkout Example

<?php

use Aamroni\PayPal\Entities\ProductsEntity;
use Aamroni\PayPal\Entities\PurchaseEntity;
use Aamroni\PayPal\Entities\ShippingEntity;
use Aamroni\PayPal\Facades\PayPal;
use Aamroni\PayPal\PayPalPaymentManager;

// @step01: Create a products information
$products =  ProductsEntity::instance(
    title: 'FoldSack No. 1 Backpack, Fits 15 Laptops',
    sku: 'SKU-FBFL',
    quantity: 1,
    regular: 109.95,
    offered: 99
);

// @step02: Create a shipping information
$shipping = ShippingEntity::instance(
    name: 'Valdemar Christensen',
    mobile: '+1 319-543-5636',
    street1: '3210 Pyramid Valley Road',
    city: 'Roanoke',
    postal: '24035',
    state: 'Virginia',
    country: 'US'
);

// @step03: Create a purchase information
$purchase = PurchaseEntity::instance(total: 10);

// @step04: Process the Stripe checkout
$paypal = PayPal::checkout(invoice: $invoice, products: $products, shipping: $shipping, purchase: $purchase);
// or
$paypal = PayPalPaymentManager::instance()->checkout(invoice: $invoice, products: $products, shipping: $shipping, purchase: $purchase);

dd($paypal);

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-04-01