Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 174 additions & 0 deletions .cursorignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
# Distribution and Environment
dist/*
build/*
venv/*
env/*
*.env
.env.*
virtualenv/*
.python-version
.ruby-version
.node-version

# Logs and Temporary Files
*.log
*.tsv
*.csv
*.txt
tmp/*
temp/*
.tmp/*
*.temp
*.cache
.cache/*
logs/*

# Sensitive Data
*.sqlite
*.sqlite3
*.dbsql
secrets.*
.npmrc
.yarnrc
.aws/*
.config/*

# Credentials and Keys
*.pem
*.ppk
*.key
*.pub
*.p12
*.pfx
*.htpasswd
*.keystore
*.jks
*.truststore
*.cer
id_rsa*
known_hosts
authorized_keys
.ssh/*
.gnupg/*
.pgpass

# Config Files
*.conf
*.toml
*.ini
.env.local
.env.development
.env.test
.env.production
config/*

# Database Files
*.sql
*.db
*.dmp
*.dump
*.backup
*.restore
*.mdb
*.accdb
*.realm*

# Backup and Archive Files
*.bak
*.backup
*.swp
*.swo
*.swn
*~
*.old
*.orig
*.archive
*.gz
*.zip
*.tar
*.rar
*.7z

# Compiled and Binary Files
*.pyc
*.pyo
**/__pycache__/**
*.class
*.jar
*.war
*.ear
*.dll
*.exe
*.so
*.dylib
*.bin
*.obj

# IDE and Editor Files
.idea/*
*.iml
.vscode/*
.project
.classpath
.settings/*
*.sublime-*
.atom/*
.eclipse/*
*.code-workspace
.history/*

# Build and Dependency Directories
node_modules/*
bower_components/*
vendor/*
packages/*
jspm_packages/*
.gradle/*
target/*
out/*

# Testing and Coverage Files
coverage/*
.coverage
htmlcov/*
.pytest_cache/*
.tox/*
junit.xml
test-results/*

# Mobile Development
*.apk
*.aab
*.ipa
*.xcarchive
*.provisionprofile
google-services.json
GoogleService-Info.plist

# Certificate and Security Files
*.crt
*.csr
*.ovpn
*.p7b
*.p7s
*.pfx
*.spc
*.stl
*.pem.crt
ssl/*

# Container and Infrastructure
*.tfstate
*.tfstate.backup
.terraform/*
.vagrant/*
docker-compose.override.yml
kubernetes/*

# Design and Media Files (often large and binary)
*.psd
*.ai
*.sketch
*.fig
*.xd
assets/raw/*
26 changes: 26 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[**.js]
indent_style = space
indent_size = 2

[**.css]
indent_style = tab
indent_size = 2

[**.php]
indent_style = space
indent_size = 4

[**.html]
indent_style = space
indent_size = 2
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: composer
directory: "razorpay-php/"
schedule:
interval: daily
time: "04:00"
timezone: Asia/Calcutta
8 changes: 8 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Note :- Please follow the below points while attaching test cases document link below:
### - If label `Tested` is added then test cases document URL is mandatory.
### - Link added should be a valid URL and accessible throughout the org.
### - If the branch name contains hotfix / revert by default the BVT workflow check will pass.

| Test Case Document URL |
|-----------------------------------------------|
| Please paste test case document link here.... |
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
config.php
.DS_Store
/.idea/
1 change: 1 addition & 0 deletions .semgrepignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.github/workflows/
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2015 Razorpay

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Razorpay Test App for PHP
Sample App for Razorpay PHP Integration

This app uses a non composer integration, ideally you should use composer to integrate the Razorpay API.

# Demo
You can see a demo of the php-testapp by opening up the `index.html` file on your browser. Follow the steps below:
1. Copy the contents of config.php.sample to config.php.
2. Enter your key id / key secret in the config.php file.
3. If you'd like a currency other than INR, change the displayCurrency to whatever currency you'd like.
4. Watch the demo to test out automatic or manual checkout.

An easy way to test this is to run `php -S localhost:8000` in the root directory
and opening <http://localhost:8000> in your browser.

## Contents:
1. Automatic checkout test app
2. Manual checkout test app

# Steps for Integration:
## Automatic Checkout
1. Make a checkout form using our Checkout Integration
2. Accept the `razorpay_payment_id` parameter in the form submission
3. Run the capture code to capture the payment

If you are re-using this as your final code, please make sure you do the following:
- Edit the keyId inside automatic-checkout/index.html
- Edit the keyId/keySecret in automatic-checkout/charge.php

## Manual Checkout
1. Create an order using razorpay orders api
2. Accept the `razorpay_payment_id` parameter and `razorpay_signature` in the form submission
3. Store the `razorpay_order_id` as a sessions variable
3. Verify the signature emitted from our server based on the algorithm given at https://docs.razorpay.com/docs/orders

If you are re-using this as your final code, please make sure you do the following:
- Edit the keyId/keySecret inside orders-api/order.php
- Edit the keySecret in orders-api/verify-signature.php

# Razorpay PHP SDK
Make sure that you download the latest version of `razorpay-php.zip` file from
the releases section **[here](https://github.com/razorpay/razorpay-php/releases)**.
You can extract that to the razorpay-php directory as well.

This release currently uses the 1.2.8 version of the SDK. Please ensure that you are
using the latest as the test app might lag behind.
11 changes: 11 additions & 0 deletions config.php.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

$keyId = '<Enter your key id>';
$keySecret = '<Enter your key secret>';
$displayCurrency = '<Enter your display currency here>';

//These should be commented out in production
// This is for error reporting
// Add it to config.php to report any errors
error_reporting(E_ALL);
ini_set('display_errors', 1);
37 changes: 37 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="utf-8">
<link rel="stylesheet" href="http://yegor256.github.io/tacit/tacit.min.css"/>
</head>
<body>
<form id="checkout-selection" method="POST">
<input type="radio" name="checkout" value="automatic">Automatic Checkout Demo<br>
<input type="radio" name="checkout" value="orders">Manual Checkout Demo<br>
<input type="submit" value="Submit">
</form>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>
jQuery(document).ready(function($)
{
var form = $('#checkout-selection');
var radio = $('input[name="checkout"]');
var choice = '';

radio.change(function(e)
{
choice = this.value;
if (choice === 'orders')
{
form.attr('action', 'pay.php?checkout=manual');
}
else
{
form.attr('action', 'pay.php?checkout=automatic');
}
});
});
</script>

</body>
</html>
Loading