{"id":19525974,"url":"https://github.com/azuriom/plugin-shop","last_synced_at":"2025-07-22T08:33:13.318Z","repository":{"id":40382403,"uuid":"237491356","full_name":"Azuriom/Plugin-Shop","owner":"Azuriom","description":"A shop plugin to sell in-game items on your website.","archived":false,"fork":false,"pushed_at":"2025-04-20T17:00:50.000Z","size":632,"stargazers_count":23,"open_issues_count":9,"forks_count":30,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-20T18:21:55.015Z","etag":null,"topics":["azuriom-plugin"],"latest_commit_sha":null,"homepage":"https://market.azuriom.com/resources/1","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Azuriom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-01-31T18:27:12.000Z","updated_at":"2025-04-20T17:00:53.000Z","dependencies_parsed_at":"2024-06-23T10:49:03.040Z","dependency_job_id":"7b08fb78-aa8f-4cd1-88f7-44ea58be38da","html_url":"https://github.com/Azuriom/Plugin-Shop","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Azuriom/Plugin-Shop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azuriom%2FPlugin-Shop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azuriom%2FPlugin-Shop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azuriom%2FPlugin-Shop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azuriom%2FPlugin-Shop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Azuriom","download_url":"https://codeload.github.com/Azuriom/Plugin-Shop/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Azuriom%2FPlugin-Shop/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266456245,"owners_count":23931383,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azuriom-plugin"],"created_at":"2024-11-11T01:07:49.070Z","updated_at":"2025-07-22T08:33:13.281Z","avatar_url":"https://github.com/Azuriom.png","language":"PHP","funding_links":["https://www.paypal.com/"],"categories":[],"sub_categories":[],"readme":"# Shop (Plugin)\n\n[![Style](https://github.styleci.io/repos/237491356/shield)](https://github.styleci.io/repos/237491356)\n[![Chat](https://img.shields.io/discord/625774284823986183?color=5865f2\u0026label=Discord\u0026logo=discord\u0026logoColor=fff\u0026style=flat-square)](https://azuriom.com/discord)\n\nA shop plugin to sell in-game items on your website.\n\n## Supported payment gateways\n\n* [PayPal](https://www.paypal.com/)\n* [PayPal Checkout](https://www.paypal.com/) (supports subscriptions)\n* [Mollie](https://www.mollie.com/) (supports subscriptions)\n* [Xsolla](https://xsolla.com/)\n* [Skrill](https://www.skrill.com/) (ex paysafecard)\n* [Stripe](https://stripe.com/) (supports subscriptions)\n* [PaymentWall](https://www.paymentwall.com/)\n* [MercadoPago](https://www.mercadopago.com/)\n\n## Custom payment gateway\n\n\u003e [!NOTE]\n\u003e Due to the large number of different payment methods available, we won't be adding any directly to the shop plugin.\n\u003e However, new payment methods can be added via a plugin, as explained below.\n\u003e It is also possible to post the plugin on the [market](https://market.azuriom.com/) to make the payment method easily accessible for users.\n\nYou can create your own payment gateway by creating a new class that extends the `Azuriom\\Plugin\\Shop\\Payment\\PaymentMethod\\PaymentMethod` class.\n\nThe `$id` and `$name` properties are required to be set in the class (the ID is the unique identifier of the payment gateway and should be lowercase).\n\n```php\n\u003c?php\n\nnamespace Azuriom\\Plugin\\BestPayment;\n\nuse Azuriom\\Plugin\\Shop\\Models\\Payment;\nuse Azuriom\\Plugin\\Shop\\Payment\\PaymentMethod;\nuse Illuminate\\Http\\Request;\n\nclass BestPaymentMethod extends PaymentMethod\n{\n    /**\n     * The payment method id name.\n     *\n     * @var string\n     */\n    protected $id = 'best-payment';\n\n    /**\n     * The payment method display name.\n     *\n     * @var string\n     */\n    protected $name = 'Best Payment';\n\n    /**\n     * Start a new payment with this method and return the payment response to the user (redirect, form, ...).\n     */\n    public function startPayment(Cart $cart, float $amount, string $currency)\n    {\n        // Create a new pending payment with the cart items\n        $payment = $this-\u003ecreatePayment($cart, $amount, $currency);\n        \n        // Start the payment process with the payment gateway\n        $response = Http::post('https://api.bestpayment.pay', [            \n            // The routes below will automatically call the methods in this class\n            'success_url' =\u003e route('shop.payments.success', $this-\u003eid),\n            'failure_url' =\u003e route('shop.payments.failure', $this-\u003eid),\n            'status_url' =\u003e route('shop.payments.notification', $this-\u003eid),\n            'custom_id' =\u003e $payment-\u003eid, // the Azuriom payment identifier\n            'amount' =\u003e $amount, // amount to pay\n            'currency' =\u003e $currency, // ISO 4217 currency code\n            'secret_key' =\u003e $this-\u003egateway-\u003edata['secret_key'],\n        ]);\n\n        // Redirect the user to the payment gateway\n        // You can also return a view depending on the payment gateway requirements\n        return redirect()-\u003eaway($response-\u003ejson('url'));\n    }\n\n    /**\n     * Handle a payment notification request sent by the payment gateway and return a response.\n     */\n    public function notification(Request $request, ?string $paymentId)\n    {\n        // This method is associated to `route('shop.payments.notification', $this-\u003eid)`\n\n        // Always verify the request is authentic to avoid fraud\n        abort_if(! $this-\u003everifySignature($request), 400);\n\n        $payment = Payment::findOrFail($request-\u003einput('custom_id'));\n        $transactionId = $request-\u003einput('transaction_id');\n        $status = $request-\u003einteger('status');\n\n        if ($status === 'refunded') {\n            return $this-\u003eprocessRefund($payment);\n        }\n\n        if ($status === 'chargeback') {\n            return $this-\u003eprocessChargeback($payment);\n        }\n\n        if ($status !== 'success') {\n            // You can return a response to the payment gateway to notify it of the error\n            return $this-\u003einvalidPayment($payment, $transactionId, 'Invalid status: '.$status);\n        }\n\n        // Process the payment and deliver the items to the user\n        return $this-\u003eprocessPayment($payment, $transactionId);\n    }\n\n    /**\n     * Get the view for the gateway config in the admin panel.\n     */\n    public function view(): string\n    {\n        return 'best-payment::admin.config';\n    }\n\n    /**\n     * Get the validation rules for the gateway config in the admin panel.\n     */\n    public function rules(): array\n    {\n        return [\n            'public_key' =\u003e ['required', 'string'],\n            'secret_key' =\u003e ['required', 'string'],\n        ];\n    }\n\n    public function image(): string\n    {\n        return asset('plugins/best-payment/img/best.svg');\n    }\n}\n```\n\nThen, you need to register your payment gateway in the `boot()` method of your plugin service provider:\n\n```php\npublic function boot(): void\n{\n    payment_manager()-\u003eregisterPaymentMethod('best-payment', BestPaymentMethod::class);\n}\n```\n\nFinally, the shop must be added in the `dependencies` of your `plugin.json` file:\n\n```json5\n{\n  // ...\n  \"dependencies\": {\n    \"shop\": \"^1.1.0\"\n  }\n}\n```\n\nFor a full example, you can check the [Dedipass Payment plugin](https://github.com/Azuriom/Plugin-DedipassPayment/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazuriom%2Fplugin-shop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazuriom%2Fplugin-shop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazuriom%2Fplugin-shop/lists"}