承接 climba-commerce/mercadopago-sdk-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

climba-commerce/mercadopago-sdk-php

Composer 安装命令:

composer require climba-commerce/mercadopago-sdk-php

包简介

Mercado Pago PHP SDK

README 文档

README

image

Mercado Pago SDK for PHP

Latest Stable Version Total Downloads License

This library provides developers with a simple set of bindings to help you integrate Mercado Pago API to a website and start receiving payments.

💡 Requirements

The SDK Supports PHP version 8.2 or higher.

💻 Installation

If you already use another version of MercadoPago PHP SDK, take a look at our migration guide from version 2 to version 3.

First time using Mercado Pago? Create your Mercado Pago account, if you don’t have one already.

  1. Download Composer if not already installed.

  2. Install PHP SDK for MercadoPago running in command line:

composer require "mercadopago/dx-php:3.0.0"

You can also run composer require "mercadopago/dx-php:2.6.1" for PHP7.1 or composer require "mercadopago/dx-php:1.12.5" for PHP5.6.

  1. Copy the access_token in the credentials section of the page and replace YOUR_ACCESS_TOKEN with it.

That's it! Mercado Pago SDK has been successfully installed.

🌟 Getting Started

Simple usage looks like:

<?php
    // Step 1: Require the library from your Composer vendor folder
    require_once 'vendor/autoload.php';

    use MercadoPago\Client\Payment\PaymentClient;
    use MercadoPago\Exceptions\MPApiException;
    use MercadoPago\MercadoPagoConfig;

    // Step 2: Set production or sandbox access token
    MercadoPagoConfig::setAccessToken("<ACCESS_TOKEN>");

    // Step 3: Initialize the API client
    $client = new PaymentClient();

    try {

        // Step 4: Create the request array
        $request = [
            "transaction_amount" => 100,
            "token" => "YOUR_CARD_TOKEN",
            "description" => "description",
            "installments" => 1,
            "payment_method_id" => "visa",
            "payer" => [
                "email" => "user@test.com",
            ]
        ];

        // Step 5: Make the request
        $payment = $client->create($request);
        echo $payment->id;

    // Step 6: Handle exceptions
    } catch (MPApiException $e) {
        echo "Status code: " . $e->getApiResponse()->getStatusCode() . "\n";
        echo "Content: " . $e->getApiResponse()->getContent() . "\n";
    } catch (\Exception $e) {
        echo $e->getMessage();
    }

Step 1: Require the library from your Composer vendor folder

require_once 'vendor/autoload.php';

use MercadoPago\Client\Payment\PaymentClient;
use MercadoPago\Exceptions\MPApiException;
use MercadoPago\MercadoPagoConfig;

Step 2: Set production or sandbox access token

MercadoPagoConfig::setAccessToken("<ACCESS_TOKEN>");

You can also set another properties as quantity of retries, tracking headers, timeouts and a custom http client.

Step 3: Initialize the API client

$client = new PaymentClient();

Step 4: Create the request array

$request = [
    "transaction_amount" => 100,
    "token" => "YOUR_CARD_TOKEN",
    "description" => "description",
    "installments" => 1,
    "payment_method_id" => "visa",
    "payer" => [
        "email" => "user@test.com",
    ]
];

Step 5: Make the request

$payment = $client->create($request);

Step 6: Handle exceptions

...
// Handle API exceptions
} catch (MPApiException $e) {
    echo "Status code: " . $e->getApiResponse()->getStatusCode() . "\n";
    echo "Content: " . $e->getApiResponse()->getContent() . "\n";

// Handle all other exceptions
} catch (\Exception $e) {
    echo $e->getMessage();
}

📚 Documentation

See our documentation for more details.

🤝 Contributing

All contributions are welcome, ranging from people wanting to triage issues, others wanting to write documentation, to people wanting to contribute code.

Please read and follow our contribution guidelines. Contributions not following these guidelines will be disregarded. The guidelines are in place to make all of our lives easier and make contribution a consistent process for everyone.

Patches to version 2.x.x

Since the release of version 3.0.0, version 2 is deprecated and will not be receiving new features, only bug fixes. If you need to submit PRs for that version, please do so by using master-v2 as your base branch.

❤️ Support

If you require technical support, please contact our support team at our developers site: English / Portuguese / Spanish

🏻 License

MIT license. Copyright (c) 2023 - Mercado Pago / Mercado Libre
For more information, see the LICENSE file.

climba-commerce/mercadopago-sdk-php 适用场景与选型建议

climba-commerce/mercadopago-sdk-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.58k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 11 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 climba-commerce/mercadopago-sdk-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 climba-commerce/mercadopago-sdk-php 我们能提供哪些服务?
定制开发 / 二次开发

基于 climba-commerce/mercadopago-sdk-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-11-24