pay-sdk-react
Version:
A cross-platform payment SDK for React, supporting Alipay, WeChat Pay, PayPal, Stripe, Payssion, and Airwallex, compatible with H5, PC, and App environments.
704 lines (703 loc) • 14.4 kB
CSS
.pay-dot-loading {
display: inline-block;
}
.pay-fullscreen-loading {
position: fixed;
z-index: 9999;
left: 0;
top: 0;
right: 0;
bottom: 0;
background: hsla(0, 0%, 100%, 0.8);
display: flex;
align-items: center;
justify-content: center;
pointer-events: auto;
user-select: none;
}
.pay-fullscreen-loading__center {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.pay-fullscreen-loading__spinner-box {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: rgba(17, 17, 17, 0.8);
border-radius: 16px;
transition: width 0.2s, height 0.2s;
box-sizing: border-box;
padding: 8px;
}
.pay-fullscreen-loading__spinner-box--no-text {
padding: 4px;
}
.pay-fullscreen-loading__spinner {
margin-bottom: 8px;
}
.pay-fullscreen-loading__spinner-box--no-text .pay-fullscreen-loading__spinner {
margin-bottom: 0;
}
.pay-fullscreen-loading__circle {
border: 3px solid rgba(255, 255, 255, 0.3);
border-top-color: #fff;
border-radius: 50%;
animation: spin 1.2s linear infinite;
}
.pay-fullscreen-loading__text {
color: #fff;
font-weight: 600;
letter-spacing: 0.25px;
text-align: center;
width: 100%;
word-break: break-all;
line-height: 1.2;
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.pay-fullscreen-loading__dots {
display: flex;
align-items: center;
gap: 10px;
}
.pay-fullscreen-loading__dot {
background: #fff;
border-radius: 50%;
animation: bounce 0.5s ease-in-out infinite;
}
.pay-fullscreen-loading__dot:nth-child(2) {
animation-delay: 0.1s;
}
.pay-fullscreen-loading__dot:nth-child(3) {
animation-delay: 0.2s;
}
.pay-fullscreen-loading__spin-dots {
position: relative;
animation: spin 1.2s steps(12) infinite;
}
.pay-fullscreen-loading__spin-dot {
position: absolute;
top: 0;
left: 50%;
background: #fff;
border-radius: 50%;
}
.pay-fullscreen-loading--small .pay-fullscreen-loading__spinner-box {
width: 88px;
height: 88px;
}
.pay-fullscreen-loading--small .pay-fullscreen-loading__spinner-box--no-text {
width: 48px;
height: 48px;
}
.pay-fullscreen-loading--small .pay-fullscreen-loading__circle {
width: 24px;
height: 24px;
border-width: 3px;
}
.pay-fullscreen-loading--small .pay-fullscreen-loading__text {
font-size: 14px;
}
.pay-fullscreen-loading--small .pay-fullscreen-loading__dot {
width: 6px;
height: 6px;
}
.pay-fullscreen-loading--small .pay-fullscreen-loading__spin-dots {
width: 28px;
height: 28px;
}
.pay-fullscreen-loading--small .pay-fullscreen-loading__spin-dot {
width: 3.5px;
height: 3.5px;
margin-left: -1.75px;
transform-origin: 50% 14px;
}
.pay-fullscreen-loading--medium .pay-fullscreen-loading__spinner-box {
width: 112px;
height: 112px;
}
.pay-fullscreen-loading--medium .pay-fullscreen-loading__spinner-box--no-text {
width: 62px;
height: 62px;
}
.pay-fullscreen-loading--medium .pay-fullscreen-loading__circle {
width: 36px;
height: 36px;
border-width: 4px;
}
.pay-fullscreen-loading--medium .pay-fullscreen-loading__text {
font-size: 16px;
}
.pay-fullscreen-loading--medium .pay-fullscreen-loading__dot {
width: 10px;
height: 10px;
}
.pay-fullscreen-loading--medium .pay-fullscreen-loading__spin-dots {
width: 40px;
height: 40px;
}
.pay-fullscreen-loading--medium .pay-fullscreen-loading__spin-dot {
width: 4.5px;
height: 4.5px;
margin-left: -2.25px;
transform-origin: 50% 20px;
}
.pay-fullscreen-loading--large .pay-fullscreen-loading__spinner-box {
width: 144px;
height: 144px;
}
.pay-fullscreen-loading--large .pay-fullscreen-loading__spinner-box--no-text {
width: 80px;
height: 80px;
}
.pay-fullscreen-loading--large .pay-fullscreen-loading__circle {
width: 42px;
height: 42px;
border-width: 5px;
}
.pay-fullscreen-loading--large .pay-fullscreen-loading__text {
font-size: 18px;
}
.pay-fullscreen-loading--large .pay-fullscreen-loading__dot {
width: 12px;
height: 12px;
}
.pay-fullscreen-loading--large .pay-fullscreen-loading__spin-dots {
width: 48px;
height: 48px;
}
.pay-fullscreen-loading--large .pay-fullscreen-loading__spin-dot {
width: 5.5px;
height: 5.5px;
margin-left: -2.75px;
transform-origin: 50% 24px;
}
.pay-fullscreen-loading--default .pay-fullscreen-loading__spinner-box {
width: 100px;
height: 100px;
}
.pay-fullscreen-loading--default .pay-fullscreen-loading__spinner-box--no-text {
width: 56px;
height: 56px;
}
.pay-fullscreen-loading--default .pay-fullscreen-loading__circle {
width: 32px;
height: 32px;
border-width: 4px;
}
.pay-fullscreen-loading--default .pay-fullscreen-loading__text {
font-size: 16px;
}
.pay-fullscreen-loading--default .pay-fullscreen-loading__dot {
width: 9px;
height: 9px;
}
.pay-fullscreen-loading--default .pay-fullscreen-loading__spin-dots {
width: 32px;
height: 32px;
}
.pay-fullscreen-loading--default .pay-fullscreen-loading__spin-dot {
width: 4px;
height: 4px;
margin-left: -2px;
transform-origin: 50% 16px;
}
.pay-fullscreen-loading__container {
position: relative;
display: block;
}
.pay-fullscreen-loading__mask {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
background: hsla(0, 0%, 100%, 0.8);
z-index: 10;
display: flex;
align-items: center;
justify-content: center;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@keyframes bounce {
0%,
100% {
transform: translateY(0);
}
50% {
transform: translateY(-12px);
}
}
.pay-button {
display: inline-block;
padding: 7px 12px;
font-size: 16px;
border-radius: 4px;
border: 1px solid #eee;
background: #fff;
color: #333;
cursor: pointer;
transition: all 0.2s;
user-select: none;
position: relative;
text-align: center;
}
.pay-button-content {
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
}
.pay-button-block {
display: block;
width: 100%;
}
.pay-button-disabled {
opacity: 0.4;
cursor: not-allowed;
}
.pay-button-loading {
cursor: wait;
}
.pay-button-loading-wrapper {
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
}
.pay-button-primary {
background: #1677ff;
border-color: #1677ff;
color: #fff;
}
.pay-button-primary:hover {
background: #409eff;
}
.pay-button-success {
background: #00b578;
border-color: #00b578;
color: #fff;
}
.pay-button-danger {
background: #ff3141;
border-color: #ff3141;
color: #fff;
}
.pay-button-warning {
background: #ff8f1f;
border-color: #ff8f1f;
color: #fff;
}
.pay-button-default {
background: #fff;
border-color: #eee;
color: #333;
}
.pay-button-fill-outline {
background: transparent;
color: inherit;
}
.pay-button-fill-none {
background: transparent;
border: none;
color: inherit;
}
.pay-button-mini {
font-size: 12px;
padding: 2px 8px;
}
.pay-button-small {
font-size: 14px;
padding: 4px 10px;
}
.pay-button-large {
font-size: 18px;
padding: 10px 18px;
}
.pay-button-shape-rounded {
border-radius: 1000px;
}
.pay-button-shape-rectangular {
border-radius: 0;
}
.pay-popup {
position: fixed;
z-index: 1001;
}
/* Base container for the animated popup body */
.pay-popup-body {
position: fixed;
display: flex;
flex-direction: column;
background-color: #ffffff;
z-index: 1010;
box-sizing: border-box;
}
/* --- Sizing and Positioning --- */
.pay-popup-body.pay-popup-body-position-bottom {
width: 100%;
left: 0;
bottom: 0;
}
.pay-popup-body.pay-popup-body-position-top {
width: 100%;
left: 0;
top: 0;
}
.pay-popup-body.pay-popup-body-position-left {
height: 100%;
width: 80vw;
left: 0;
top: 0;
}
.pay-popup-body.pay-popup-body-position-right {
height: 100%;
width: 80vw;
right: 0;
top: 0;
}
/* --- Round Corners Modifier --- */
.pay-popup-body.pay-popup-body-round.pay-popup-body-position-bottom {
border-radius: 16px 16px 0 0;
}
.pay-popup-body.pay-popup-body-round.pay-popup-body-position-top {
border-radius: 0 0 16px 16px;
}
.pay-popup-body.pay-popup-body-round.pay-popup-body-position-left {
border-radius: 0 16px 16px 0;
}
.pay-popup-body.pay-popup-body-round.pay-popup-body-position-right {
border-radius: 16px 0 0 16px;
}
/* --- Close Icon --- */
.pay-popup-close-icon {
position: absolute;
z-index: 1;
cursor: pointer;
padding: 4px;
font-size: 18px;
line-height: 1;
color: #999;
}
.pay-popup-body.pay-popup-body-position-bottom .pay-popup-close-icon,
.pay-popup-body.pay-popup-body-position-left .pay-popup-close-icon {
top: 8px;
right: 8px;
}
.pay-popup-body.pay-popup-body-position-top .pay-popup-close-icon {
bottom: 8px;
right: 8px;
}
.pay-popup-body.pay-popup-body-position-right .pay-popup-close-icon {
top: 8px;
left: 8px;
}
/* --- Content Area --- */
.pay-popup-content {
flex: 1;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
/* --- Padding adjustment when close icon is visible --- */
.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-bottom .pay-popup-content,
.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-left .pay-popup-content {
padding-top: 40px;
}
.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-right .pay-popup-content {
padding-top: 40px;
}
.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-top .pay-popup-content {
padding-bottom: 40px;
}
.pay-mask-content {
position: relative;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 0 88px;
}
.pay-mask-close {
position: absolute;
right: 12px;
top: 12px;
background: none;
border: none;
font-size: 28px;
color: #fff;
cursor: pointer;
z-index: 1;
}
.pay-mask-title {
display: flex;
align-items: center;
gap: 4px;
font-weight: 700;
font-size: 28px;
color: #fff;
margin-bottom: 16px;
text-shadow: 0 2px 8px #000;
}
.pay-mask-title > .pay-icon-paypal-white {
width: 36px;
height: 36px;
}
.pay-mask-desc {
color: #fff;
text-align: center;
margin-bottom: 24px;
line-height: 1.5;
white-space: pre-line;
}
.pay-mask-continue {
color: #fff;
font-weight: 700;
text-decoration: underline;
text-underline-offset: 4px;
cursor: pointer;
text-align: center;
font-size: 18px;
}
.pay-icon {
display: inline-block;
color: inherit;
width: 16px;
vertical-align: -2px;
stroke: currentColor;
}
.pay-icon[fill='currentColor'] {
fill: currentColor;
stroke: none;
}
.pay-icon[stroke='currentColor'] {
stroke: currentColor;
fill: none;
}
.pay-icon[fill='currentColor'][stroke='currentColor'] {
fill: currentColor;
stroke: currentColor;
}
.pay-icon-paypal-text {
width: 64px;
height: 26px;
max-width: 72px;
max-height: 32px;
}
.pay-icon-close {
width: 18px;
height: 18px;
}
.pay-icon-stripe-text {
width: 24px;
height: 24px;
}
.pay-icon-alipay {
width: 20px;
height: 20px;
}
.pay-icon-wechat-pay {
width: 20px;
height: 20px;
}
.pay-icon-payssion-pay {
width: 36px;
height: 20px;
}
.pay-mask {
position: fixed;
z-index: 1000;
left: 0;
top: 0;
right: 0;
bottom: 0;
display: flex;
align-items: center;
justify-content: center;
}
.pay-modal {
position: fixed;
z-index: 9999;
left: 0;
top: 0;
right: 0;
bottom: 0;
display: flex;
align-items: center;
justify-content: center;
}
.pay-modal__mask {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.55);
z-index: 0;
}
.pay-modal__content {
position: relative;
z-index: 1;
background: #fff;
border-radius: 16px;
padding: 42px 20px 20px 20px;
min-width: 280px;
max-width: 80vw;
box-shadow: 0 4px 24px #0001;
text-align: center;
max-height: 60vh;
display: flex;
flex-direction: column;
}
.pay-modal__close {
position: absolute;
right: 12px;
top: 12px;
background: none;
border: none;
font-size: 28px;
cursor: pointer;
text-align: left;
}
.pay-modal__icon {
margin-bottom: 8px;
font-size: 40px;
}
.pay-modal__title {
font-size: 20px;
font-weight: 700;
color: #222;
margin-bottom: 12px;
}
.pay-modal__desc {
color: #222;
font-size: 15px;
margin-bottom: 24px;
line-height: 1.7;
text-align: left;
}
.pay-modal__content-wrapper {
position: relative;
z-index: 1;
text-align: center;
overflow-y: auto;
flex: 1;
min-height: 0;
}
.pay-modal__actions {
display: flex;
justify-content: center;
gap: 16px;
margin-top: 16px;
}
.pay-modal__btn {
min-width: 96px;
padding: 8px 0;
border-radius: 24px;
border: none;
font-size: 15px;
font-weight: 600;
cursor: pointer;
transition: background 0.2s;
}
.pay-modal__btn--retry {
background: #fff;
color: #f25a5a;
border: 1.5px solid #f25a5a;
}
.pay-modal__btn--finish {
background: #f25a5a;
color: #fff;
border: none;
}
.pay-paypal-btn.pay-button > span {
display: flex;
align-items: center;
gap: 0.5rem;
}
@media (min-width: 576px) {
.pay-stripe-modal.pay-modal .pay-modal__content {
width: 72%;
}
}
@media (min-width: 768px) {
.pay-stripe-modal.pay-modal .pay-modal__content {
width: 50%;
}
}
@media (min-width: 992px) {
.pay-stripe-modal.pay-modal .pay-modal__content {
width: 40%;
}
}
@media (min-width: 1200px) {
.pay-stripe-modal.pay-modal .pay-modal__content {
width: 27%;
}
}
@media (min-width: 1600px) {
.pay-stripe-modal.pay-modal .pay-modal__content {
width: 26%;
}
}
@media (min-width: 2000px) {
.pay-stripe-modal.pay-modal .pay-modal__content {
width: 20%;
}
}
.pay-alipay-qr-iframe {
display: flex;
flex-direction: column;
align-items: center;
}
.pay-alipay-qr-iframe__iframe {
border: none;
width: 210px;
height: 210px;
margin-top: 10px;
margin-bottom: 8px;
}
.pay-alipay-qr-iframe__tip {
text-align: center;
color: #333;
font-size: 14px;
line-height: 20px;
}
.pay-wechat-qrcode {
display: flex;
flex-direction: column;
align-items: center;
}
.pay-wechat-qrcode__container {
background-color: #fff;
border-radius: 8px;
display: flex;
justify-content: center;
align-items: center;
width: 210px;
height: 210px;
}
.pay-wechat-qrcode__image {
width: 100%;
height: 100%;
object-fit: cover;
}
.pay-wechat-qrcode__tip {
text-align: center;
color: #333;
font-size: 14px;
line-height: 20px;
}