- How do I install tpay-com/tpay-openapi-php in Laravel?
- Install the package with Composer by requiring tpay-com/tpay-openapi-php in your Laravel project. Because it is a standard PHP SDK, Laravel will autoload it without needing a special Laravel package. You can then configure your Tpay credentials and optionally bind the client in a service provider for dependency injection.
- Does tpay-com/tpay-openapi-php work with Laravel or only plain PHP?
- It works with any PHP application, including Laravel. The SDK is not Laravel-specific, so you use Composer autoloading and can wrap the client in Laravel services, facades, or container bindings if you want a more framework-native setup. This makes it flexible for both Laravel and non-Laravel PHP projects.
- What Tpay operations does this PHP SDK support?
- The SDK supports creating payments, verifying transactions, issuing refunds, and managing accounts through the Tpay.com OpenAPI. It provides a clean, typed client that wraps the Tpay online payment gateway. Authentication is handled by the SDK so you can focus on your application logic.
- How does authentication work with the Tpay OpenAPI PHP SDK?
- The SDK handles authentication for you, so you do not need to build the Tpay OpenAPI authentication flow manually. You provide the credentials issued by Tpay, and the client manages authenticated requests. Keep those credentials in environment variables or Laravel config rather than hard-coding them.
- Can I create Tpay payments from a Laravel controller with this package?
- Yes. You can inject or instantiate the Tpay client in a Laravel controller or service and use it to create a payment through the OpenAPI. Keep payment creation in a dedicated service class if you want cleaner controllers and easier testing. After creation, redirect the customer or return the payment data your frontend needs.
- How do I verify a Tpay transaction before fulfilling an order?
- Use the SDK's transaction verification capability to check the payment status server-side before marking an order as paid. Do not rely only on the browser returning to your success page, because that can be spoofed or interrupted. Store the Tpay transaction identifier with your order so you can verify and reconcile it later.
- Can I issue refunds through tpay-com/tpay-openapi-php?
- Yes, issuing refunds is one of the supported Tpay OpenAPI operations in this SDK. You will typically reference the original transaction or payment identifier and submit the refund through the typed client. Handle refund responses and errors carefully, and record refund status in your Laravel application for auditing.
- How should I test Tpay payments in Laravel without charging real cards?
- For unit tests, mock the Tpay client or the underlying HTTP layer so your Laravel tests do not call the real API. For integration testing, use the test credentials or test environment Tpay provides for your account. Always keep production credentials out of test configuration and CI logs.
- Is tpay-com/tpay-openapi-php production-ready and actively maintained?
- It is the official PHP SDK for the Tpay.com OpenAPI, which makes it the natural choice for Tpay integrations. Before production, check Packagist and the repository for the latest release, PHP version requirements, and maintenance activity. Pin a tested Composer version and review changelogs before upgrading.
- What are alternatives to tpay-com/tpay-openapi-php for Laravel payments?
- If you specifically need Tpay, this official SDK is the direct option; alternatives would be calling the Tpay OpenAPI over raw HTTP or using community wrappers. If you are not tied to Tpay, Laravel Cashier targets gateways such as Stripe and Paddle rather than Tpay. For most Tpay Laravel projects, the official SDK is the safest starting point.